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:
|
||||
try:
|
||||
await message.clear_reactions()
|
||||
except discord.Forbidden: # cannot remove all reactions
|
||||
if message.channel.permissions_for(ctx.me).manage_messages:
|
||||
await message.clear_reactions()
|
||||
else:
|
||||
raise RuntimeError
|
||||
except (discord.Forbidden, RuntimeError): # cannot remove all reactions
|
||||
for key in controls.keys():
|
||||
await message.remove_reaction(key, ctx.bot.user)
|
||||
try:
|
||||
await message.remove_reaction(key, ctx.bot.user)
|
||||
except discord.Forbidden:
|
||||
return
|
||||
except discord.HTTPException:
|
||||
pass
|
||||
except discord.NotFound:
|
||||
return
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user