1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 13:02:38 +00:00

Ignore bot actions without permissions

This commit is contained in:
Myned 2022-03-04 00:02:32 -06:00
parent 977a8b1d1e
commit 534544d598
No known key found for this signature in database
GPG key ID: 33790F979F7A28B8

6
run.py
View file

@ -24,10 +24,14 @@ bot = lightbulb.BotApp(
# Listener for global command exceptions # Listener for global command exceptions
@bot.listen(lightbulb.CommandErrorEvent) @bot.listen(lightbulb.CommandErrorEvent)
async def on_error(event): async def on_error(event):
match event.exception.__cause__ or event.exception:
case hikari.ForbiddenError():
pass
case _:
await bot.application.owner.send(c.error(event)) await bot.application.owner.send(c.error(event))
try: try:
await event.context.respond(c.ERROR) await event.context.respond(c.ERROR, flags=hikari.MessageFlag.EPHEMERAL)
except: except:
await event.context.interaction.edit_initial_response(c.ERROR, components=None) await event.context.interaction.edit_initial_response(c.ERROR, components=None)