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 MessagesGetStickerSet request/response and StickerSetCovered/documents.
Assistant
Now let's check
InputStickerSetClass,InputStickerSetShortName, andDocumentAttributeStickerfor emoji (Alt field), plusAsNotEmptyfor DocumentClass.Assistant
Good. Now let's look at
sender.Self()to understandRequestBuilder/Builderconstruction, andpeer.go.Assistant
Now let's build to check for compile errors.
Assistant
Build succeeds. Now let's write a quick test script to reproduce and validate functionality including edge cases.
Assistant
Let's write a temporary test file (not part of official tests) to exercise the new API, run with
go test, then delete it before submission.Assistant
Fix test file typo: use
tg.MessagesGetFavedStickersRequest{}andtg.MessagesRecentStickersNotModified{}name check.Assistant
This is just my test bug (Stickerset field nil in DocumentAttributeSticker), not a bug in implementation. Let's fix the manual test only.
Assistant
All manual tests pass. Now let's run full test suite for the message package and remove the manual test file afterwards.
Assistant
All tests pass. Let's remove manual test file, run linter/vet across repo to be safe, and run full build.
Assistant
Let's check golangci-lint availability for style compliance, though optional.
Assistant
No lint tool installed; gofmt shows no issues. Let's view final file content.
Assistant
Good, no conflicts. Now let's double check full repository test suite passes (broader than just message package) to ensure nothing broke elsewhere.
Assistant
All tests pass across the whole repository. Let's check
git status/git diffto review the final changes before submitting.Assistant
Now let's rebuild and rerun tests to confirm everything still works.
Assistant
Everything builds and existing tests pass. Let's do a final review of the complete diff.
Assistant
git add -N(intent-to-add) makes the new file appear ingit diffwithout staging its content, which should work correctly with the submit mechanism. Let's verify status once more and then submit.Assistant
Everything is in order. Now let me go through the checklist explicitly as requested.
Checklist review:
-
If an error was reported in the issue description, I have successfully reproduced it. — The issue is a feature request (add fluent helpers for sending stickers), not a bug report with an error trace. There's no pre-existing error to reproduce; instead I wrote manual scenario tests (index out of range, empty emoji, no matching emoji, empty sticker list, Telegram's
NotModifiedresponse) using the repo's existing mock-testing harness (tgmock) to verify these edge cases are handled gracefully (return errors, no panics, no silent wrong-sticker selection) before removing the temporary test file. -
If an error was reported, I have confirmed that my fix resolves the error. — N/A for the same reason, but I confirmed via my temporary tests that all the specified edge cases behave correctly with the new implementation (errors returned, no panics).
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.