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: