async def invoke_and_catch(self, interaction: InteractionCommand): try: command = interaction.command if isinstance(command, ApplicationCommand): tag = self.get_tag(interaction.guild, command.id) await self.process_tag(interaction, tag) elif interaction.command_id == self.eval_command: await self.slash_eval(interaction) else: log.debug("Unknown interaction created:\n%r", interaction) except Exception as e: raise commands.CommandInvokeError(e) from e
async def on_slash_interaction(self, interaction: InteractionCommand): try: command = interaction.command if isinstance(command, SlashCommand): tag = self.get_tag(interaction.guild, command.id) await self.process_tag(interaction, tag) elif interaction.command_id == self.eval_command: await self.slash_eval(interaction) else: log.debug("Unknown interaction created:\n%r" % interaction) except Exception as e: ctx = SlashContext.from_interaction(interaction) self.bot.dispatch("command_error", ctx, commands.CommandInvokeError(e))
async def slash_command_parser(self, data: dict): try: interaction = InteractionResponse(data=data, cog=self) except Exception as e: log.exception( f"An exception occured while parsing an interaction:\n{data}", exc_info=e ) return try: await self.handle_interaction(interaction) except Exception as e: log.exception( f"An exception occured while handling an interaction:\n{data}", exc_info=e ) ctx = SlashContext.from_interaction(interaction) self.bot.dispatch("command_error", ctx, commands.CommandInvokeError(e))