@@ -102,18 +102,17 @@ async def setup(self, *, creator=None, category=None):
102
102
overwrites = overwrites ,
103
103
reason = "Creating a thread channel" ,
104
104
)
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.
106
106
del self .manager .cache [self .id ]
107
107
log_channel = self .bot .log_channel
108
108
109
109
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"
111
111
em .description = e .message
112
- em .add_field (name = ' Recipient' , value = recipient .mention )
112
+ em .add_field (name = " Recipient" , value = recipient .mention )
113
113
114
114
if log_channel is not None :
115
115
return await log_channel .send (embed = em )
116
-
117
116
118
117
self ._channel = channel
119
118
@@ -191,7 +190,7 @@ async def close(
191
190
silent : bool = False ,
192
191
delete_channel : bool = True ,
193
192
message : str = None ,
194
- auto_close : bool = False
193
+ auto_close : bool = False ,
195
194
) -> None :
196
195
"""Close a thread now or after a set time in seconds"""
197
196
@@ -333,12 +332,11 @@ async def _close(
333
332
334
333
await asyncio .gather (* tasks )
335
334
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 :
339
337
self .close_task .cancel ()
340
338
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 :
342
340
self .auto_close_task .cancel ()
343
341
self .auto_close_task = None
344
342
@@ -415,7 +413,9 @@ async def _restart_close_timer(self):
415
413
f" '{ time_marker_regex } ' to specify time."
416
414
)
417
415
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
+ )
419
419
420
420
async def edit_message (self , message_id : int , message : str ) -> None :
421
421
recipient_msg , channel_msg = await asyncio .gather (
@@ -503,7 +503,6 @@ async def reply(self, message: discord.Message, anonymous: bool = False) -> None
503
503
)
504
504
)
505
505
506
-
507
506
# Cancel closing if a thread message is sent.
508
507
if self .close_task is not None :
509
508
await self .cancel_closure ()
@@ -529,7 +528,9 @@ async def send(
529
528
anonymous : bool = False ,
530
529
) -> None :
531
530
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
533
534
534
535
if self .close_task is not None :
535
536
# cancel closing if a thread message is sent.
@@ -549,7 +550,6 @@ async def send(
549
550
if not from_mod and not note :
550
551
self .bot .loop .create_task (self .bot .api .append_log (message , self .channel .id ))
551
552
552
-
553
553
destination = destination or self .channel
554
554
555
555
author = message .author
0 commit comments