mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Cleanup] Handle NotFound error of prompt in check_100_plus (#5191)
* [Cleanup] Handle HTTPException of prompt in check_100_plus * Update redbot/cogs/cleanup/cleanup.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
42edb12b2e
commit
4366af6f6c
@ -1,3 +1,4 @@
|
|||||||
|
import contextlib
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Callable, List, Optional, Set, Union
|
from typing import Callable, List, Optional, Set, Union
|
||||||
@ -61,11 +62,10 @@ class Cleanup(commands.Cog):
|
|||||||
response = await ctx.bot.wait_for("message", check=MessagePredicate.same_context(ctx))
|
response = await ctx.bot.wait_for("message", check=MessagePredicate.same_context(ctx))
|
||||||
|
|
||||||
if response.content.lower().startswith("y"):
|
if response.content.lower().startswith("y"):
|
||||||
await prompt.delete()
|
with contextlib.suppress(discord.NotFound):
|
||||||
try:
|
await prompt.delete()
|
||||||
|
with contextlib.suppress(discord.HTTPException):
|
||||||
await response.delete()
|
await response.delete()
|
||||||
except discord.HTTPException:
|
|
||||||
pass
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
await ctx.send(_("Cancelled."))
|
await ctx.send(_("Cancelled."))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user