This commit is contained in:
insert 2024-08-11 13:17:50 -04:00
parent 8804bc6d75
commit 8c3fed91ff
Signed by: insert
GPG key ID: A70775C389ACF105

13
misc.py
View file

@ -9,7 +9,7 @@ from urllib.parse import urlparse
import os import os
import sys import sys
errormsg = ["How could you do this to me!", "I tried my best...", "There's always next time", "Simply processed too hard", "Perhaps this will be fixed", "You found an easter egg! Wait no it's just an error..."] errormsg = ["How could you do this to me!", "I tried my best...", "Maybe this will be fixed next patch", "There's always next time", "Simply processed too hard", "Perhaps this will be fixed", "You found an easter egg! Wait no it's just an error..."]
class misc(commands.Cog): class misc(commands.Cog):
@ -20,23 +20,14 @@ class misc(commands.Cog):
@commands.Cog.listener('on_application_command_error') @commands.Cog.listener('on_application_command_error')
async def errorhandler(self, interaction: nextcord.Interaction, error: nextcord.DiscordException): async def errorhandler(self, interaction: nextcord.Interaction, error: nextcord.DiscordException):
error = traceback.format_exception(type(error), error, error.__traceback__) error = traceback.format_exception(type(error), error, error.__traceback__)
print(error, file=sys.stderr)
random.shuffle(errormsg) random.shuffle(errormsg)
strerror = "".join(error) strerror = "".join(error)
print(strerror, file=sys.stderr)
message = f"{errormsg[0]}\n```py\n{strerror[-1800:]}\n```\n Contact <@{self.bot.owner_id}> if the error persists" message = f"{errormsg[0]}\n```py\n{strerror[-1800:]}\n```\n Contact <@{self.bot.owner_id}> if the error persists"
try: try:
await interaction.response.send_message(message, ephemeral=True) await interaction.response.send_message(message, ephemeral=True)
except: except:
await interaction.followup.send(message, ephemeral=True) await interaction.followup.send(message, ephemeral=True)
@nextcord.slash_command(
name="error",
description="DEBUG: throw an error",
guild_ids=[699285282276507708],
)
async def thrower(self, interaction: nextcord.Interaction):
errorlist = [1,2]
await interaction.response.send_message(errorlist[4])
def setup(bot: commands.Bot): def setup(bot: commands.Bot):
bot.add_cog(misc(bot)) bot.add_cog(misc(bot))