Skip to content

fix: fix sticker items and add to forwards#28

Merged
AlexFlipnote merged 5 commits into
AlexFlipnote:masterfrom
Snazzah:fix/sticker-items
May 28, 2026
Merged

fix: fix sticker items and add to forwards#28
AlexFlipnote merged 5 commits into
AlexFlipnote:masterfrom
Snazzah:fix/sticker-items

Conversation

@Snazzah
Copy link
Copy Markdown
Contributor

@Snazzah Snazzah commented May 28, 2026

Description

Sticker items have format types, and also messane snapshots show these, good for getting the URL properly.

Summary by CodeRabbit

Bug Fixes

  • Improved sticker data handling with proper format information tracking
  • Sticker format is now correctly preserved across message contexts
  • Sticker URLs generate dynamically based on format type

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@Snazzah, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 35 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7bed608e-10de-46f9-931c-8fe497850ce6

📥 Commits

Reviewing files that changed from the base of the PR and between db7ece7 and ef6df98.

📒 Files selected for processing (2)
  • discord_http/message.py
  • discord_http/sticker.py
📝 Walkthrough

Walkthrough

This PR extends sticker handling across the Discord API layer to track and use format_type metadata. PartialSticker now stores format type and generates file URLs with the correct extension (png, gif, or json) based on that type. Sticker inherits this behavior. Both Message and MessageSnapshot populate sticker instances with format type during construction.

Changes

Sticker Format Type Support

Layer / File(s) Summary
PartialSticker format_type and URL generation
discord_http/sticker.py
PartialSticker adds format_type field stored and initialized in __slots__ and constructor, and PartialSticker.url property now derives the output file extension from format_type, mapping gifgif, lottiejson, and defaulting to png.
Sticker inheritance alignment
discord_http/sticker.py
Sticker.__init__ passes format_type to PartialSticker via super().__init__, and the Sticker.url property override is removed so URL generation uses the inherited PartialSticker.url.
Message and snapshot sticker creation
discord_http/message.py
MessageSnapshot.__slots__ declares stickers, MessageSnapshot initialization builds sticker instances from sticker_items with format_type, and Message parsing passes format_type when constructing PartialSticker objects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A sticker with format now stands tall,
PNG, GIF, or JSON—it handles them all! 🎨
From snapshot to message, the format flows through,
Dynamic extensions craft the right view. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix sticker items and add to forwards' directly matches the main changeset focus: adding sticker support to MessageSnapshot and improving sticker format handling.
Description check ✅ Passed The description addresses the core purpose (sticker items have format types for proper URL construction) and mentions message snapshots, but the explanation contains a typo ('messane' instead of 'message') and is somewhat vague about implementation details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
discord_http/sticker.py (1)

22-27: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix PLW0244 by removing inherited format_type from Sticker.__slots__.

Ruff reports only PLW0244 at line 211: Slot format_type redefined from base class PartialSticker. Remove "format_type" from class Sticker.__slots__ (keep it only in PartialSticker; Sticker.__init__ already forwards format_type to super()), so URL/type behavior remains unchanged.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@discord_http/sticker.py` around lines 22 - 27, Sticker.__slots__ currently
re-declares "format_type" which duplicates the slot defined in PartialSticker
and triggers PLW0244; remove "format_type" from Sticker.__slots__ so it only
contains "_state", "guild_id", and "name" and let Sticker.__init__ continue
forwarding format_type to super() (PartialSticker keeps the format_type slot) to
preserve URL/type behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@discord_http/message.py`:
- Around line 1544-1547: The MessageSnapshot code is reading stickers from the
root payload (data.get("sticker_items", [])) which misses snapshot stickers
nested under the "message" key; update the sticker parsing in MessageSnapshot
(in _from_data) to read from the nested message object (e.g. use the "message"
dict's "sticker_items") when constructing PartialSticker instances so forwarded
snapshots populate MessageSnapshot.stickers correctly.

---

Outside diff comments:
In `@discord_http/sticker.py`:
- Around line 22-27: Sticker.__slots__ currently re-declares "format_type" which
duplicates the slot defined in PartialSticker and triggers PLW0244; remove
"format_type" from Sticker.__slots__ so it only contains "_state", "guild_id",
and "name" and let Sticker.__init__ continue forwarding format_type to super()
(PartialSticker keeps the format_type slot) to preserve URL/type behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44ae8a46-29c4-4172-a22d-7c1cd4955e89

📥 Commits

Reviewing files that changed from the base of the PR and between d20e743 and db7ece7.

📒 Files selected for processing (2)
  • discord_http/message.py
  • discord_http/sticker.py

Comment thread discord_http/message.py Outdated
@Snazzah
Copy link
Copy Markdown
Contributor Author

Snazzah commented May 28, 2026

Other linting lines from Ruff aren't related to this PR

@AlexFlipnote AlexFlipnote merged commit ec89d12 into AlexFlipnote:master May 28, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants