Skip to content

Commit a532fd0

Browse files
committed
Handle thread deletion while awaiting confirmation
1 parent 26a1042 commit a532fd0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mandatory_close_duration/mandatory_close_duration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ def checkmark_press_check(reaction: discord.Reaction, user: discord.User) -> boo
3232
try:
3333
await ctx.bot.wait_for('reaction_add', check=checkmark_press_check, timeout=5 * 60)
3434
except asyncio.TimeoutError:
35-
await message.edit(content=message.content+'\n\n**Timed out.**')
36-
await message.clear_reactions()
35+
try:
36+
await message.edit(content=message.content+'\n\n**Timed out.**')
37+
await message.clear_reactions()
38+
except discord.NotFound:
39+
# The thread might have been closed by now.
40+
pass
3741
else:
3842
await original_close_command(ctx, after=converted_arg)
3943

0 commit comments

Comments
 (0)