Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@


class PiBotCommandTree(app_commands.CommandTree):
client: PiBot

def __init__(self, client: PiBot):
super().__init__(client)

Expand Down Expand Up @@ -95,15 +97,23 @@ async def on_error(
)
elif isinstance(error, app_commands.CommandInvokeError):
message = "This command experienced a general error."
if error.original:
message += f"\n{error.original}"

# Report error to staff
reporter_cog = self.client.get_cog("Reporter")

assert isinstance(reporter_cog, Reporter)
await reporter_cog.create_command_error_report(
error.original,
interaction.command,
)
if isinstance(reporter_cog, Reporter):
await reporter_cog.create_command_error_report(
error.original,
interaction.command,
)
else:
logger.warning(
"Reporter cog was not of type `Reporter`. Was instead: {}".format(
type(reporter_cog),
),
)

elif isinstance(error, app_commands.TransformerError):
message = "This command experienced a transformer error."
Expand Down
Loading