mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-09 20:58:54 -05:00
Prevent error when ctx.send_interactive prompt is deleted (#2447)
Supress excpetions which may occur when attempting to delete a prompt. fixes #2380
This commit is contained in:
parent
2e2d669fdf
commit
f91e0a6546
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import contextlib
|
||||||
from typing import Iterable, List
|
from typing import Iterable, List
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
@ -167,6 +168,7 @@ class Context(commands.Context):
|
|||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
|
with contextlib.suppress(discord.HTTPException):
|
||||||
await query.delete()
|
await query.delete()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -176,6 +178,7 @@ class Context(commands.Context):
|
|||||||
# In case the bot can't delete other users' messages,
|
# In case the bot can't delete other users' messages,
|
||||||
# or is not a bot account
|
# or is not a bot account
|
||||||
# or channel is a DM
|
# or channel is a DM
|
||||||
|
with contextlib.suppress(discord.HTTPException):
|
||||||
await query.delete()
|
await query.delete()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user