mirror of
https://github.com/uhIgnacio/EmoteManager.git
synced 2024-08-15 02:23:13 +00:00
support WEBP
This commit is contained in:
parent
fcc1f405e3
commit
7e5f01b82d
2 changed files with 4 additions and 2 deletions
|
@ -60,14 +60,14 @@ class FileTooBigError(EmoteManagerError):
|
|||
self.limit = limit
|
||||
|
||||
class InvalidFileError(EmoteManagerError):
|
||||
"""The file is not a zip, tar, GIF, PNG, or JPG file."""
|
||||
"""The file is not a zip, tar, GIF, PNG, JPG, or WEBP file."""
|
||||
def __init__(self):
|
||||
super().__init__('Invalid file given.')
|
||||
|
||||
class InvalidImageError(InvalidFileError):
|
||||
"""The image is not a GIF, PNG, or JPG"""
|
||||
def __init__(self):
|
||||
super(Exception, self).__init__('The image supplied was not a GIF, PNG, or JPG.')
|
||||
super(Exception, self).__init__('The image supplied was not a GIF, PNG, JPG, or WEBP file.')
|
||||
|
||||
class PermissionDeniedError(EmoteManagerError):
|
||||
"""Raised when a user tries to modify an emote without the Manage Emojis permission"""
|
||||
|
|
|
@ -87,6 +87,8 @@ def mime_type_for_image(data):
|
|||
return 'image/jpeg'
|
||||
if data.startswith((b'GIF87a', b'GIF89a')):
|
||||
return 'image/gif'
|
||||
if data.startswith(b'RIFF') and data[8:12] == b'WEBP':
|
||||
return 'image/webp'
|
||||
raise errors.InvalidImageError
|
||||
|
||||
def image_to_base64_url(data):
|
||||
|
|
Loading…
Reference in a new issue