bugfix: cannot add reaction to interactions, add exception handling/stop sending related errors to discord context
This commit is contained in:
parent
97808e388f
commit
3bb1ea8ccc
13
cogs/misc.py
13
cogs/misc.py
@ -1088,7 +1088,11 @@ class Misc(commands.Cog):
|
|||||||
recipient = discord.utils.escape_mentions(recipient.strip())
|
recipient = discord.utils.escape_mentions(recipient.strip())
|
||||||
try:
|
try:
|
||||||
response = await ctx.respond(f"*hands **{recipient_normal}** a muffin*")
|
response = await ctx.respond(f"*hands **{recipient_normal}** a muffin*")
|
||||||
|
try:
|
||||||
await response.add_reaction(emoji="<:muffin:1314233635586707456>")
|
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")
|
await self.util.increment_counter("muffins")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
@ -1129,7 +1133,11 @@ class Misc(commands.Cog):
|
|||||||
recipient = discord.utils.escape_mentions(recipient.strip())
|
recipient = discord.utils.escape_mentions(recipient.strip())
|
||||||
try:
|
try:
|
||||||
response = await ctx.respond(f"*hands **{recipient_normal}** a side of bacon*")
|
response = await ctx.respond(f"*hands **{recipient_normal}** a side of bacon*")
|
||||||
|
try:
|
||||||
await response.add_reaction(emoji="🥓")
|
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")
|
await self.util.increment_counter("bacon_sides")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
@ -1444,8 +1452,9 @@ class Misc(commands.Cog):
|
|||||||
await self.util.increment_counter("coffees")
|
await self.util.increment_counter("coffees")
|
||||||
try:
|
try:
|
||||||
await response.add_reaction(emoji="☕")
|
await response.add_reaction(emoji="☕")
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
logging.debug("Failed to add coffee reaction: %s",
|
||||||
|
str(e)) # known: cannot react to interaction
|
||||||
|
|
||||||
def cog_unload(self) -> None:
|
def cog_unload(self) -> None:
|
||||||
"""Run on Cog Unload"""
|
"""Run on Cog Unload"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user