mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Check permissions before trying to clear reactions (#3589)
This commit is contained in:
parent
b52c838018
commit
d6f9ddc3af
@ -96,10 +96,18 @@ async def menu(
|
|||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
try:
|
try:
|
||||||
|
if message.channel.permissions_for(ctx.me).manage_messages:
|
||||||
await message.clear_reactions()
|
await message.clear_reactions()
|
||||||
except discord.Forbidden: # cannot remove all reactions
|
else:
|
||||||
|
raise RuntimeError
|
||||||
|
except (discord.Forbidden, RuntimeError): # cannot remove all reactions
|
||||||
for key in controls.keys():
|
for key in controls.keys():
|
||||||
|
try:
|
||||||
await message.remove_reaction(key, ctx.bot.user)
|
await message.remove_reaction(key, ctx.bot.user)
|
||||||
|
except discord.Forbidden:
|
||||||
|
return
|
||||||
|
except discord.HTTPException:
|
||||||
|
pass
|
||||||
except discord.NotFound:
|
except discord.NotFound:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user