1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00

add-zip: fix error message for invalid files

This commit is contained in:
Benjamin Mintz 2019-08-04 10:38:29 +00:00
parent bf668e10b9
commit 4828a4ff52
3 changed files with 8 additions and 9 deletions

View file

@ -235,9 +235,11 @@ class Emotes(commands.Cog):
"""Try to add an emote from bytes. On error, return a string that should be sent to the user."""
try:
emote = await self.create_emote_from_bytes(guild, name, author_id, image_data, reason=reason)
except discord.InvalidArgument:
return discord.utils.escape_mentions(f'{name}: The file supplied was not a valid GIF, PNG, or JPEG file.')
except discord.HTTPException as ex:
return (
'An error occurred while creating the emote:\n'
return discord.utils.escape_mentions(
f'{name}: An error occurred while creating the the emote:\n'
+ utils.format_http_exception(ex))
return f'Emote {emote} successfully created.'