@@ -873,14 +873,33 @@ async def config_remove(self, ctx, *, key: str.lower):
873873 color = self .bot .main_color ,
874874 description = f"`{ key } ` had been reset to default." ,
875875 )
876+
877+ # Cancel exsisting active closures from thread_auto_close due to being disabled.
878+ if key == "thread_auto_close" :
879+ closures = self .bot .config ["closures" ]
880+ for recipient_id , items in tuple (closures .items ()):
881+ if items .get ("auto_close" , False ) is True :
882+ self .bot .config ["closures" ].pop (recipient_id )
883+ thread = await self .bot .threads .find (recipient_id = int (recipient_id ))
884+ if thread :
885+ await thread .cancel_closure (all = True )
886+ else :
887+ self .bot .config ["closures" ].pop (recipient_id )
888+ # Only update config once after processing all closures
889+ await self .bot .config .update ()
876890 else :
877- embed = discord .Embed (
878- title = "Error" ,
879- color = self .bot .error_color ,
880- description = f"{ key } is an invalid key." ,
881- )
882- valid_keys = [f"`{ k } `" for k in sorted (keys )]
883- embed .add_field (name = "Valid keys" , value = ", " .join (valid_keys ))
891+ embeds = []
892+ for names in zip_longest (* (iter (sorted (keys )),) * 15 ):
893+ description = "\n " .join (f"`{ name } `" for name in takewhile (lambda x : x is not None , names ))
894+ embed = discord .Embed (
895+ title = "Error - Invalid Key" ,
896+ color = self .bot .error_color ,
897+ description = f"`{ key } ` is an invalid key.\n \n **Valid configuration keys:**\n { description } " ,
898+ )
899+ embeds .append (embed )
900+
901+ session = EmbedPaginatorSession (ctx , * embeds )
902+ return await session .run ()
884903
885904 return await ctx .send (embed = embed )
886905
@@ -1129,7 +1148,7 @@ async def alias_raw(self, ctx, *, name: str.lower):
11291148
11301149 return await ctx .send (embed = embed )
11311150
1132- async def make_alias (self , name , value , action ):
1151+ async def make_alias (self , name , value , action , ctx ):
11331152 values = utils .parse_alias (value )
11341153 if not values :
11351154 embed = discord .Embed (
@@ -1176,16 +1195,23 @@ async def make_alias(self, name, value, action):
11761195 if multiple_alias :
11771196 embed .description = (
11781197 "The command you are attempting to point "
1179- f"to does not exist: `{ linked_command } `."
1198+ f"to on step { i } does not exist: `{ linked_command } `."
11801199 )
11811200 else :
11821201 embed .description = (
11831202 "The command you are attempting to point "
1184- f"to on step { i } does not exist: `{ linked_command } `."
1203+ f"to does not exist: `{ linked_command } `."
11851204 )
11861205
11871206 return embed
11881207 else :
1208+ if linked_command == "eval" and not await checks .check_permissions (ctx , "eval" ):
1209+ embed = discord .Embed (
1210+ title = "Error" ,
1211+ description = "You can only add the `eval` command to an alias if you have permissions for that command." ,
1212+ color = self .bot .error_color ,
1213+ )
1214+ return embed
11891215 save_aliases .append (val )
11901216 if multiple_alias :
11911217 embed .add_field (name = f"Step { i } :" , value = utils .truncate (val , 1024 ))
@@ -1240,7 +1266,7 @@ async def alias_add(self, ctx, name: str.lower, *, value):
12401266 )
12411267
12421268 if embed is None :
1243- embed = await self .make_alias (name , value , "Added" )
1269+ embed = await self .make_alias (name , value , "Added" , ctx )
12441270 return await ctx .send (embed = embed )
12451271
12461272 @alias .command (name = "remove" , aliases = ["del" , "delete" ])
@@ -1272,7 +1298,7 @@ async def alias_edit(self, ctx, name: str.lower, *, value):
12721298 embed = utils .create_not_found_embed (name , self .bot .aliases .keys (), "Alias" )
12731299 return await ctx .send (embed = embed )
12741300
1275- embed = await self .make_alias (name , value , "Edited" )
1301+ embed = await self .make_alias (name , value , "Edited" , ctx )
12761302 return await ctx .send (embed = embed )
12771303
12781304 @alias .command (name = "rename" )
0 commit comments