Skip to content

feat: add GIF sticker format #1915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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