Skip to content

Commit

Permalink
feat: add GIF sticker format (#1915)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
4 people authored Feb 10, 2023
1 parent af12f33 commit 08af163
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#1859](https://github.com/Pycord-Development/pycord/pull/1859))
- Added new `suppress_notifications` to `MessageFlags`.
([#1912](https://github.com/Pycord-Development/pycord/pull/1912))
- Added GIF sticker format type to the `StickerFormatType` enum.
([#1915](https://github.com/Pycord-Development/pycord/pull/1915))

### Changed

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

## [2.3.2] - 2022-12-03

Expand Down
5 changes: 4 additions & 1 deletion discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,18 @@ class StickerFormatType(Enum):
png = 1
apng = 2
lottie = 3
gif = 4

@property
def file_extension(self) -> str:
lookup: dict[StickerFormatType, str] = {
StickerFormatType.png: "png",
StickerFormatType.apng: "png",
StickerFormatType.lottie: "json",
StickerFormatType.gif: "gif",
}
return lookup[self]
# TODO: Improve handling of unknown sticker format types if possible
return lookup.get(self, "png")


class InviteTarget(Enum):
Expand Down
6 changes: 6 additions & 0 deletions docs/api/enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,12 @@ of :class:`enum.Enum`.

Represents a sticker with a lottie image.

.. attribute:: gif

Represents a sticker with a gif image.

.. versionadded:: 2.4

.. class:: InviteTarget

Represents the invite type for voice channel invites.
Expand Down

0 comments on commit 08af163

Please sign in to comment.