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
I'll start by exploring the repository structure and existing sticker-related code to understand the patterns used.
- Assistant
There's already a
stickers.gofile. I'll inspect it and similar builders for patterns. - Assistant
I'll search for existing sticker-set APIs and similar fluent helper patterns.
- Assistant
rg is not available, let me use grep instead.
- Assistant
I'll inspect document sending patterns, Media APIs, and any sticker-set references in docs.
- Assistant
Looking for related issues and similarBuilder APIs that fetch then send media.
- Assistant
Looking at ISSUES.md more carefully for issue #189 about sticker helpers.
- Assistant
I'll inspect the TG sticker APIs and message package test/
Senderpatterns next. - Assistant
I'll examine response types for sticker set/list APIs and how sticker attributes carry emoji.
- Assistant
I'll inspect StickerPack/attribute emoji fields and existing media tests for patterns.
- Assistant
I'll search the repo history and docs for sticker helper design notes.
- Assistant
Checking how other features structure source/builder patterns and Media methods.
- Assistant
Let me also check InputStickerSetShortName and MessagesGetStickerSet API, DocumentAttributeCustomEmoji for custom emoji stickers, and how to match stickers by emoji from documents' attributes.
- Assistant
I'll check FileLocation, tag helpers for attributes, and error-handling conventions.
- Assistant
Let me also look at DocumentAttributeClassArray helpers for finding sticker Alt.
- Assistant
Looking at the client method for GetStickerSet and similar patterns that handle NotModified responses.
- Assistant
Checking Examples and CustomEmoji attribute, then reviewing sender exposures of raw.
- Assistant
I'll look for related hidden files or intention comments and inspect the MessagesGetRecentStickers request shape.
- Assistant
Implementing
sticker_set.goand a temporary test to verify behavior. - Assistant
Creating the sticker set helpers file.
- Assistant
The create may have failed; checking and rewriting the file.
- Assistant
Writing the file with a shell redirect instead.
- Assistant
Writing a temporary test to verify the helpers, then running it.
- Assistant
Setting Go module cache paths and rerunning tests.
- Assistant
All tests passed. Removing the temporary test file (per instructions) and running the package tests.
- Assistant
Reviewing the final implementation one more time.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.