bugfix: cannot add reaction to interactions, add exception handling/stop sending related errors to discord context
This commit is contained in:
		
							
								
								
									
										13
									
								
								cogs/misc.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								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*") | ||||
|             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*") | ||||
|             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""" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user