@@ -102,18 +102,17 @@ async def setup(self, *, creator=None, category=None):
102102 overwrites = overwrites ,
103103 reason = "Creating a thread channel" ,
104104 )
105- except discord .HTTPException as e : # Failed to create due to 50 channel limit.
105+ except discord .HTTPException as e : # Failed to create due to 50 channel limit.
106106 del self .manager .cache [self .id ]
107107 log_channel = self .bot .log_channel
108108
109109 em = discord .Embed (color = discord .Color .red ())
110- em .title = ' Error while trying to create a thread'
110+ em .title = " Error while trying to create a thread"
111111 em .description = e .message
112- em .add_field (name = ' Recipient' , value = recipient .mention )
112+ em .add_field (name = " Recipient" , value = recipient .mention )
113113
114114 if log_channel is not None :
115115 return await log_channel .send (embed = em )
116-
117116
118117 self ._channel = channel
119118
@@ -191,7 +190,7 @@ async def close(
191190 silent : bool = False ,
192191 delete_channel : bool = True ,
193192 message : str = None ,
194- auto_close : bool = False
193+ auto_close : bool = False ,
195194 ) -> None :
196195 """Close a thread now or after a set time in seconds"""
197196
@@ -333,12 +332,11 @@ async def _close(
333332
334333 await asyncio .gather (* tasks )
335334
336- async def cancel_closure (self , auto_close : bool = False ) -> None :
337-
338- if self .close_task is not None and not auto_close :
335+ async def cancel_closure (self , auto_close : bool = False , all : bool = False ) -> None :
336+ if self .close_task is not None and not auto_close or both :
339337 self .close_task .cancel ()
340338 self .close_task = None
341- elif self .auto_close_task is not None :
339+ if self .auto_close_task is not None and auto_close or both :
342340 self .auto_close_task .cancel ()
343341 self .auto_close_task = None
344342
@@ -415,7 +413,9 @@ async def _restart_close_timer(self):
415413 f" '{ time_marker_regex } ' to specify time."
416414 )
417415
418- await self .close (closer = self .bot .user , after = seconds , message = close_message , auto_close = True )
416+ await self .close (
417+ closer = self .bot .user , after = seconds , message = close_message , auto_close = True
418+ )
419419
420420 async def edit_message (self , message_id : int , message : str ) -> None :
421421 recipient_msg , channel_msg = await asyncio .gather (
@@ -503,7 +503,6 @@ async def reply(self, message: discord.Message, anonymous: bool = False) -> None
503503 )
504504 )
505505
506-
507506 # Cancel closing if a thread message is sent.
508507 if self .close_task is not None :
509508 await self .cancel_closure ()
@@ -529,7 +528,9 @@ async def send(
529528 anonymous : bool = False ,
530529 ) -> None :
531530
532- self .bot .loop .create_task (self ._restart_close_timer ()) # Start or restart thread auto close
531+ self .bot .loop .create_task (
532+ self ._restart_close_timer ()
533+ ) # Start or restart thread auto close
533534
534535 if self .close_task is not None :
535536 # cancel closing if a thread message is sent.
@@ -549,7 +550,6 @@ async def send(
549550 if not from_mod and not note :
550551 self .bot .loop .create_task (self .bot .api .append_log (message , self .channel .id ))
551552
552-
553553 destination = destination or self .channel
554554
555555 author = message .author
0 commit comments