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

add webp to an error message

This commit is contained in:
io mintz 2020-06-11 23:59:13 +00:00
parent 0173884617
commit 7b2f963dd7

View file

@ -334,7 +334,7 @@ class Emotes(commands.Cog):
try: try:
emote = await self.create_emote_from_bytes(context.guild, name, author_id, image_data, reason=reason) emote = await self.create_emote_from_bytes(context.guild, name, author_id, image_data, reason=reason)
except discord.InvalidArgument: except discord.InvalidArgument:
return discord.utils.escape_mentions(f'{name}: The file supplied was not a valid GIF, PNG, or JPEG file.') return discord.utils.escape_mentions(f'{name}: The file supplied was not a valid GIF, PNG, JPEG, or WEBP file.')
except discord.HTTPException as ex: except discord.HTTPException as ex:
return discord.utils.escape_mentions( return discord.utils.escape_mentions(
f'{name}: An error occurred while creating the the emote:\n' f'{name}: An error occurred while creating the the emote:\n'
@ -342,7 +342,7 @@ class Emotes(commands.Cog):
s = f'Emote {emote} successfully created' s = f'Emote {emote} successfully created'
return s + ' as a GIF.' if converted else s + '.' return s + ' as a GIF.' if converted else s + '.'
async def fetch(self, url, valid_mimetypes=None, *, validate_headers=True): async def fetch(self, url, valid_mimetypes=IMAGE_MIMETYPES, *, validate_headers=True):
valid_mimetypes = valid_mimetypes or self.IMAGE_MIMETYPES valid_mimetypes = valid_mimetypes or self.IMAGE_MIMETYPES
def validate_headers(response): def validate_headers(response):
response.raise_for_status() response.raise_for_status()