Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Add fluent helpers for sending stickers from Telegram sticker sets Support the public…

  1. User

    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.

  2. Assistant

    I'll explore the message package and similar sticker patterns so we can implement the fluent sticker-set helpers to match the declared interface.

  3. Assistant

    Implementing sticker_set.go with cached sources and error handling, then adding tests.

  4. Assistant

    Added fluent sticker-set helpers in telegram/message/sticker_set.go.

    API

    • Sources: FavedStickers(), RecentStickers(), StickerSet(), StickerSetName(shortName)
    • Builder: sender.To(peer).Sticker(source) → StickerSetBuilder
    • Fetch: .Stickers(ctx, raw) — list all stickers without sending
    • Send: .First(ctx), .ByIndex(ctx, n), .ByEmoji(ctx, emoji) — optional caption via StyledTextOption

    Error handling

    • Invalid index → "sticker index N out of range (have M)"
    • Missing emoji → "sticker with emoji \"…\" not found"
    • Empty list → index 0 is out of range (no silent fallback)
    • Not-modified without cache → explicit error; with cache → returns cached stickers

    Example

    // Send first sticker from a named set
    _, err := sender.Resolve("@durov").
        Sticker(message.StickerSetName("AnimatedEmojies")).
        First(ctx)
    
    // Send by emoji from favorites
    _, err := sender.Self().
        Sticker(message.FavedStickers()).
        ByEmoji(ctx, "👍")
    
    // List stickers without sending
    stickers, err := sender.Self().
        Sticker(message.RecentStickers()).
        Stickers(ctx, tg.NewClient(client))
    

    Each StickerSource caches its hash and sticker list so *NotModified responses reuse prior data instead of failing or returning the wrong sticker. Tests are in sticker_set_test.go.The sticker-set helpers are in place in telegram/message/sticker_set.go. All StickerSet tests pass.

    You can send stickers from faved lists, recent stickers, or named sets with .First(), .ByIndex(), or .ByEmoji(), and edge cases (invalid index, missing emoji, empty results, not-modified without cache) return clear errors instead of panicking or picking the wrong sticker.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.