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