
from discord import app_commands

import logging
import sys
import traceback

import sentry_sdk


class CommandTree(app_commands.CommandTree):

    async def on_error(self, interaction, command, error):
        sentry_sdk.capture_exception(error)
        print(
            f"Ignoring exception in slash command {command.name}",
            # TODO: Use full name
            file = sys.stderr
        )
        traceback.print_exception(
            type(error), error, error.__traceback__, file = sys.stderr
        )
        logging.getLogger("errors").error(
            "Uncaught exception\n",
            exc_info = (type(error), error, error.__traceback__)
        )


from discord import app_commands

import logging
import sys
import traceback

import sentry_sdk


class CommandTree(app_commands.CommandTree):

    async def on_error(self, interaction, error):
        sentry_sdk.capture_exception(error)
        print(
            f"Ignoring exception in slash command {interaction.command.name}",
            # TODO: Use full name
            file = sys.stderr
        )
        traceback.print_exception(
            type(error), error, error.__traceback__, file = sys.stderr
        )
        logging.getLogger("errors").error(
            "Uncaught exception\n",
            exc_info = (type(error), error, error.__traceback__)
        )

Update CommandTree.on_error to only take two parameters
[Discord] Update CommandTree.on_error to only take two parameters

Remove command parameter, matching discord.py update, and use Interaction.command instead
