From 3bb1ea8ccc98297db631227c817960da804bbb7d Mon Sep 17 00:00:00 2001 From: codey Date: Fri, 14 Mar 2025 06:33:50 -0400 Subject: [PATCH] bugfix: cannot add reaction to interactions, add exception handling/stop sending related errors to discord context --- cogs/misc.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cogs/misc.py b/cogs/misc.py index 7c1aaab..299a1d6 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -1088,7 +1088,11 @@ class Misc(commands.Cog): recipient = discord.utils.escape_mentions(recipient.strip()) try: response = await ctx.respond(f"*hands **{recipient_normal}** a muffin*") - await response.add_reaction(emoji="<:muffin:1314233635586707456>") + try: + await response.add_reaction(emoji="<:muffin:1314233635586707456>") + except Exception as e: + logging.debug("Failed to add muffin reaction: %s", + str(e)) # known: cannot react to interaction await self.util.increment_counter("muffins") except Exception as e: traceback.print_exc() @@ -1129,7 +1133,11 @@ class Misc(commands.Cog): recipient = discord.utils.escape_mentions(recipient.strip()) try: response = await ctx.respond(f"*hands **{recipient_normal}** a side of bacon*") - await response.add_reaction(emoji="🥓") + try: + await response.add_reaction(emoji="🥓") + except Exception as e: + logging.debug("Failed to add bacon reaction: %s", + str(e)) # known: cannot react to interactions await self.util.increment_counter("bacon_sides") except Exception as e: traceback.print_exc() @@ -1444,8 +1452,9 @@ class Misc(commands.Cog): await self.util.increment_counter("coffees") try: await response.add_reaction(emoji="☕") - except: - pass + except Exception as e: + logging.debug("Failed to add coffee reaction: %s", + str(e)) # known: cannot react to interaction def cog_unload(self) -> None: """Run on Cog Unload"""