Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating error webhook #266

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions bot/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import json
import logging
import os
import traceback
Expand Down Expand Up @@ -113,8 +114,12 @@ async def on_app_command_error(self, interaction: "InteractionType", error: app_

async def publish_error(self, interaction: "InteractionType", error: app_commands.AppCommandError) -> None:
"""Publishes the error to our error webhook."""
content = "\n".join(traceback.format_exception(type(error), error, error.__traceback__))
header = f"Ignored exception in command **{interaction.command.qualified_name}**"
content = "".join(traceback.format_exception(type(error), error, error.__traceback__))
header = (
f"Ignored exception in command **{interaction.command.qualified_name}** Invoked by **{interaction.user}**"
f"in channel **{interaction.channel.name}**"
)
invoked_details_document = await paste.create(str(json.dumps(interaction.data, indent=4)))
SylteA marked this conversation as resolved.
Show resolved Hide resolved

def wrap(code: str) -> str:
code = code.replace("`", "\u200b`")
Expand All @@ -129,6 +134,7 @@ def wrap(code: str) -> str:
embed = discord.Embed(
title=header, description=content, color=discord.Color.red(), timestamp=discord.utils.utcnow()
)
embed.add_field(name="Command Details: ", value=invoked_details_document.url, inline=True)
await self.error_webhook.send(embed=embed)

@tasks.loop(hours=24)
Expand Down
Loading