Skip to content

Commit 08af163

Browse files
DorukyumBobDotComplun1331Lulalaby
authored
feat: add GIF sticker format (#1915)
Signed-off-by: Dorukyum <[email protected]> Co-authored-by: BobDotCom <[email protected]> Co-authored-by: plun1331 <[email protected]> Co-authored-by: Lala Sabathil <[email protected]>
1 parent af12f33 commit 08af163

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ These changes are available on the `master` branch, but have not yet been releas
2929
([#1859](https://github.com/Pycord-Development/pycord/pull/1859))
3030
- Added new `suppress_notifications` to `MessageFlags`.
3131
([#1912](https://github.com/Pycord-Development/pycord/pull/1912))
32+
- Added GIF sticker format type to the `StickerFormatType` enum.
33+
([#1915](https://github.com/Pycord-Development/pycord/pull/1915))
3234

3335
### Changed
3436

@@ -41,6 +43,8 @@ These changes are available on the `master` branch, but have not yet been releas
4143
`AttributeError`, and `io.BytesIO` files didn't send properly more than once.
4244
([#1869](https://github.com/Pycord-Development/pycord/pull/1869) &
4345
[#1881](https://github.com/Pycord-Development/pycord/pull/1881))
46+
- Fixed an unhandled `KeyError` exception when receiving GIF stickers.
47+
([#1915](https://github.com/Pycord-Development/pycord/pull/1915))
4448

4549
## [2.3.2] - 2022-12-03
4650

discord/enums.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,18 @@ class StickerFormatType(Enum):
616616
png = 1
617617
apng = 2
618618
lottie = 3
619+
gif = 4
619620

620621
@property
621622
def file_extension(self) -> str:
622623
lookup: dict[StickerFormatType, str] = {
623624
StickerFormatType.png: "png",
624625
StickerFormatType.apng: "png",
625626
StickerFormatType.lottie: "json",
627+
StickerFormatType.gif: "gif",
626628
}
627-
return lookup[self]
629+
# TODO: Improve handling of unknown sticker format types if possible
630+
return lookup.get(self, "png")
628631

629632

630633
class InviteTarget(Enum):

docs/api/enums.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,12 @@ of :class:`enum.Enum`.
16431643

16441644
Represents a sticker with a lottie image.
16451645

1646+
.. attribute:: gif
1647+
1648+
Represents a sticker with a gif image.
1649+
1650+
.. versionadded:: 2.4
1651+
16461652
.. class:: InviteTarget
16471653

16481654
Represents the invite type for voice channel invites.

0 commit comments

Comments
 (0)