Browse Source

Implement GIF stickers (fix crash)

pull/10109/head
dolfies 2 years ago
parent
commit
6887e34fcd
  1. 4
      discord/enums.py
  2. 2
      discord/types/sticker.py
  3. 6
      docs/api.rst

4
discord/enums.py

@ -694,6 +694,7 @@ class StickerFormatType(Enum):
png = 1
apng = 2
lottie = 3
gif = 4
@property
def file_extension(self) -> str:
@ -702,9 +703,10 @@ class StickerFormatType(Enum):
StickerFormatType.png: 'png',
StickerFormatType.apng: 'png',
StickerFormatType.lottie: 'json',
StickerFormatType.gif: 'gif',
}
# fmt: on
return lookup[self]
return lookup.get(self, 'png')
class ReportType(Enum):

2
discord/types/sticker.py

@ -30,7 +30,7 @@ from typing_extensions import NotRequired
from .snowflake import Snowflake
from .user import User
StickerFormatType = Literal[1, 2, 3]
StickerFormatType = Literal[1, 2, 3, 4]
class StickerItem(TypedDict):

6
docs/api.rst

@ -3210,6 +3210,12 @@ of :class:`enum.Enum`.
Represents a sticker with a lottie image.
.. attribute:: gif
Represents a sticker with a gif image.
.. versionadded:: 2.0
.. class:: InviteTarget
Represents the invite type for voice channel invites.

Loading…
Cancel
Save