Update
This commit is contained in:
parent
1e2cc628ac
commit
7d0646d957
2 changed files with 16 additions and 1 deletions
15
misc.py
15
misc.py
|
@ -29,5 +29,20 @@ class misc(commands.Cog):
|
||||||
except:
|
except:
|
||||||
await interaction.followup.send(message, ephemeral=True)
|
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):
|
def setup(bot: commands.Bot):
|
||||||
bot.add_cog(misc(bot))
|
bot.add_cog(misc(bot))
|
|
@ -86,7 +86,7 @@ class ApplicationModal(nextcord.ui.Modal):
|
||||||
)
|
)
|
||||||
print(self.image.value)
|
print(self.image.value)
|
||||||
if urlparse(self.image.value).netloc != 'media.discordapp.net' and urlparse(self.image.value).netloc != 'cdn.discordapp.com':
|
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
|
return
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(self.image.value) as response:
|
async with session.get(self.image.value) as response:
|
||||||
|
|
Loading…
Reference in a new issue