From 7d0646d9571294319b863b0e411d4015ece452ad Mon Sep 17 00:00:00 2001 From: insert Date: Sun, 11 Aug 2024 13:42:11 -0400 Subject: [PATCH] Update --- misc.py | 15 +++++++++++++++ speechbubble.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/misc.py b/misc.py index 635b18a..0e79746 100644 --- a/misc.py +++ b/misc.py @@ -29,5 +29,20 @@ class misc(commands.Cog): except: await interaction.followup.send(message, ephemeral=True) + @commands.Cog.listener('on_error') + async def seconderrorhandler(self, event_method, *args, **kwargs): + error = traceback.format_exc() + random.shuffle(errormsg) + print(error, file=sys.stderr) + message = f"{errormsg[0]}\n```py\n{error[-1800:]}\n```\n Contact <@{self.bot.owner_id}> if the error persists" + try: + await interaction.response.send_message(message, ephemeral=True) + except: + try: + await interaction.followup.send(message, ephemeral=True) + except: + await interaction.send(message, ephemeral=True) + + def setup(bot: commands.Bot): bot.add_cog(misc(bot)) \ No newline at end of file diff --git a/speechbubble.py b/speechbubble.py index 4513500..360c6ca 100644 --- a/speechbubble.py +++ b/speechbubble.py @@ -86,7 +86,7 @@ class ApplicationModal(nextcord.ui.Modal): ) print(self.image.value) if urlparse(self.image.value).netloc != 'media.discordapp.net' and urlparse(self.image.value).netloc != 'cdn.discordapp.com': - await interaction.send(f"for security reasons, the bot only accepts images from media.discordapp.net or cdn.discordapp.com", ephemeral=True) + await interaction.send_message(f"for security reasons, the bot only accepts images from media.discordapp.net or cdn.discordapp.com", ephemeral=True) return async with aiohttp.ClientSession() as session: async with session.get(self.image.value) as response: