ISSUE DESCRIPTION Add fluent helpers for sending stickers from Telegram sticker sets…
- User
ISSUE DESCRIPTION
Add fluent helpers for sending stickers from Telegram sticker sets
Support the public sticker-set sources and builder operations declared in the Interface. A caller must be able to select a sticker by index or emoji and send the first sticker. Invalid indexes, missing emoji, empty results, and Telegram's not-modified response must be handled without panics or silently selecting a different sticker.
Interface
Type: Function Name: FavedStickers Path: telegram/message/sticker_set.go Input: Output: StickerSource Description: Returns a StickerSource that retrieves the user's favorite stickers via messages.getFavedStickers. Use this when you want to send or pick from a user's faved sticker list.
Type: Function Name: RecentStickers Path: telegram/message/sticker_set.go Input: Output: StickerSource Description: Returns a StickerSource that retrieves the user's recently used stickers via messages.getRecentStickers. Use this when you want to send or pick from recently sent stickers.
Type: Function Name: StickerSetName Path: telegram/message/sticker_set.go Input: shortName: string Output: StickerSource Description: Returns a StickerSource that resolves a sticker set by its short name (e.g., "AnimatedEmojies"). It wraps StickerSet with an InputStickerSetShortName.
Type: Function Name: Sticker Path: telegram/message/sticker_set.go Input: source: StickerSource Output: *StickerSetBuilder Description: Creates a StickerSetBuilder from the given StickerSource, allowing the caller to pick and send a specific sticker from that source. Chain ByIndex, ByEmoji, or First onto the returned builder.
Type: Function Name: Stickers Path: telegram/message/sticker_set.go Input: ctx: context.Context, raw: *tg.Client Output: ([]tg.DocumentClass, error) Description: Method on StickerSetBuilder that fetches the full list of sticker documents from the underlying StickerSource. Call this if you need all stickers without immediately sending one.
Type: Function Name: ByIndex Path: telegram/message/sticker_set.go Input: ctx: context.Context, index: int, caption: ...StyledTextOption Output: (tg.UpdatesClass, error) Description: Sends the sticker at the given zero-based index from the StickerSource. Returns an error if the index is out of range.
Type: Function Name: ByEmoji Path: telegram/message/sticker_set.go Input: ctx: context.Context, emoji: string, caption: ...StyledTextOption Output: (tg.UpdatesClass, error) Description: Sends the first sticker from the source whose alternative emoji matches the provided emoji string. Returns an error if no matching sticker is found.
Type: Function Name: First Path: telegram/message/sticker_set.go Input: ctx: context.Context, caption: ...StyledTextOption Output: (tg.UpdatesClass, error) Description: Sends the first sticker from the StickerSource by delegating to ByIndex with index 0. Convenience method for sending the top sticker.
ADDITIONAL ADVICE
Assistant
Now let's check MessagesRecentStickers and MessagesStickerSet (for StickerSetName).
Assistant
Now let's check how
Senderexposesrawand whether there's a way forSenderto have a public method to get raw client, and check request_builder.go for.To(peer)usage pattern for tests to mimic.Assistant
Builds successfully. Now run go vet and existing tests in the message package.
Assistant
All tests pass. Now let's write a quick reproduction/verification script using a mock RPC to simulate scenarios: valid index, invalid index, missing emoji, empty results, not-modified response.
Assistant
Now let's write a temporary test script (not adding to repo permanently) to verify our implementation end-to-end using tgmock.
Assistant
That's just a test-data issue (need Stickerset field in attribute). Let's fix the temp test.
Assistant
All scenarios pass: valid index/emoji selection, invalid index, missing emoji, empty results, and not-modified responses for both faved and recent stickers — all handled gracefully with errors, no panics. Now remove the temporary test file and run the full test suite once more.
Assistant
All tests pass across the whole telegram tree. Let's double check gofmt formatting and git diff.
Assistant
This looks clean. Let's check RequestBuilder wraps Builder too, to make sure
Stickermethod is accessible fromRequestBuilder(e.g.,sender.Self()returns what type?).Assistant
Those are pre-existing formatting issues unrelated to our change. Let's confirm our new file isn't among them (it's not) and check final diff.
Assistant
Good, only our new file was added, unrelated files untouched (pre-existing gofmt issues are not something we introduced). Let's run the full repository test suite once more to be safe.
Assistant
Entire repository builds and all tests pass (no failures reported, only "no test files" entries). Now let's review the checklist.
Assistant
Using
git add -N(intent-to-add) makes the new file visible ingit diffwithout fully staging content changes, ensuring it will be included when submitting. Let's verify full diff now.Assistant
Now the diff correctly reflects our new file. Let's go through the checklist explicitly.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.