From eadf4ab9cfcd01dd5109403438edf29628c435a5 Mon Sep 17 00:00:00 2001 From: Sarthak singh Date: Tue, 14 Nov 2023 21:03:15 +0530 Subject: [PATCH 1/2] updating error webhook --- bot/core.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bot/core.py b/bot/core.py index f3a14134..66a89ae7 100644 --- a/bot/core.py +++ b/bot/core.py @@ -1,4 +1,5 @@ import datetime +import json import logging import os import traceback @@ -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))) def wrap(code: str) -> str: code = code.replace("`", "\u200b`") @@ -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) From 84eece24d602555bf814d3e96e9de39f785923d7 Mon Sep 17 00:00:00 2001 From: Sarthak singh Date: Tue, 14 Nov 2023 21:25:00 +0530 Subject: [PATCH 2/2] updating json indent to 2 --- bot/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/core.py b/bot/core.py index 66a89ae7..da362fac 100644 --- a/bot/core.py +++ b/bot/core.py @@ -119,7 +119,7 @@ async def publish_error(self, interaction: "InteractionType", error: app_command 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))) + invoked_details_document = await paste.create(str(json.dumps(interaction.data, indent=2))) def wrap(code: str) -> str: code = code.replace("`", "\u200b`")