@@ -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
0 commit comments