From a0362c75c71a5889c3b18f963a5e87d14c1ec799 Mon Sep 17 00:00:00 2001 From: nex <53234499+EEKIM10@users.noreply.github.com> Date: Sun, 30 Oct 2022 16:05:54 +0000 Subject: [PATCH] Fix some events --- cogs/events.py | 2 ++ main.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index c0140c6..42f0217 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -89,6 +89,8 @@ class Events(commands.Cog): @commands.Cog.listener() async def on_message(self, message: discord.Message): + if not message.guild: + return if message.channel.name == "pinboard": if message.type == discord.MessageType.pins_add: await message.delete(delay=0.01) diff --git a/main.py b/main.py index aeee40c..b0d9249 100644 --- a/main.py +++ b/main.py @@ -37,8 +37,10 @@ async def on_application_command_error(ctx: discord.ApplicationContext, error: E @bot.listen("on_command_error") -async def on_command_error(ctx: discord.ApplicationContext, error: Exception): - await ctx.respond("Command Error: `%r`" % error) +async def on_command_error(ctx: commands.Context, error: Exception): + if isinstance(error, commands.CommandNotFound): + return + await ctx.reply("Command Error: `%r`" % error) raise error