From 534544d59829b958f881e884108fad9e424ee31c Mon Sep 17 00:00:00 2001 From: Myned Date: Fri, 4 Mar 2022 00:02:32 -0600 Subject: [PATCH] Ignore bot actions without permissions --- run.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/run.py b/run.py index e484f8f..3b647da 100644 --- a/run.py +++ b/run.py @@ -24,14 +24,18 @@ bot = lightbulb.BotApp( # Listener for global command exceptions @bot.listen(lightbulb.CommandErrorEvent) async def on_error(event): - await bot.application.owner.send(c.error(event)) + match event.exception.__cause__ or event.exception: + case hikari.ForbiddenError(): + pass + case _: + await bot.application.owner.send(c.error(event)) - try: - await event.context.respond(c.ERROR) - except: - await event.context.interaction.edit_initial_response(c.ERROR, components=None) + try: + await event.context.respond(c.ERROR, flags=hikari.MessageFlag.EPHEMERAL) + except: + await event.context.interaction.edit_initial_response(c.ERROR, components=None) - raise event.exception + raise event.exception miru.load(bot)