Skip to content

fix: gif stickers use a different base url #2781

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 4 commits into from
May 13, 2025
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
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ These changes are available on the `master` branch, but have not yet been releas
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
- Fixed `Subscription.renewal_sku_ids` not accepting `None` from the received payload.
([#2709](https://github.com/Pycord-Development/pycord/pull/2709))
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`.
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
- Fixed missing `None` type hints in `Select.__init__`.
([#2746])(https://github.com/Pycord-Development/pycord/pull/2746)
([#2746](https://github.com/Pycord-Development/pycord/pull/2746))
- Updated `valid_locales` to support `in` and `es-419`.
([#2767])(https://github.com/Pycord-Development/pycord/pull/2767)
([#2767](https://github.com/Pycord-Development/pycord/pull/2767))
- Fixed `Webhook.edit` not working with `attachments=[]`.
([#2779])(https://github.com/Pycord-Development/pycord/pull/2779)
([#2779](https://github.com/Pycord-Development/pycord/pull/2779))
- Fixed GIF-based `Sticker` returning the wrong `url`.
([#2781](https://github.com/Pycord-Development/pycord/pull/2781))

### Changed

Expand Down
14 changes: 12 additions & 2 deletions discord/sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ def __init__(self, *, state: ConnectionState, data: StickerItemPayload):
self.format: StickerFormatType = try_enum(
StickerFormatType, data["format_type"]
)
self.url: str = f"{Asset.BASE}/stickers/{self.id}.{self.format.file_extension}"
base = (
"https://media.discordapp.net"
if self.format is StickerFormatType.gif
else Asset.BASE
)
self.url: str = f"{base}/stickers/{self.id}.{self.format.file_extension}"

def __repr__(self) -> str:
return f"<StickerItem id={self.id} name={self.name!r} format={self.format}>"
Expand Down Expand Up @@ -288,7 +293,12 @@ def _from_data(self, data: StickerPayload) -> None:
self.format: StickerFormatType = try_enum(
StickerFormatType, data["format_type"]
)
self.url: str = f"{Asset.BASE}/stickers/{self.id}.{self.format.file_extension}"
base = (
"https://media.discordapp.net"
if self.format is StickerFormatType.gif
else Asset.BASE
)
self.url: str = f"{base}/stickers/{self.id}.{self.format.file_extension}"

def __repr__(self) -> str:
return f"<Sticker id={self.id} name={self.name!r}>"
Expand Down