fix: update createNewStickerSet/addStickerToSet to current Bot API (#1236)#1314
Open
yagop wants to merge 1 commit into
Open
fix: update createNewStickerSet/addStickerToSet to current Bot API (#1236)#1314yagop wants to merge 1 commit into
yagop wants to merge 1 commit into
Conversation
Both methods still sent the pre-6.6 `png_sticker`/`emojis` fields, which Telegram rejects with `400 Bad Request: invalid sticker emojis`. Rewrite them to the current `stickers[]` / `InputSticker` API as a single options object: each sticker's file (Buffer / stream / local path) is uploaded via an `attach://` part, while a file_id / URL string passes through unchanged. Adds a `_buildStickerItems` helper mirroring `_buildMediaItems`. Breaking change to both public method signatures. Refs #1236 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
createNewStickerSetandaddStickerToSetwere hand-ported from the pre-6.6 Bot API and still send the long-removedpng_sticker/emojisfields. Telegram rejects that with400 Bad Request: invalid sticker emojis, so both methods are unusable on the current API.Refs #1236
Fix
Rewrite both to the current API, using the single options-object shape (matches the generated
CreateNewStickerSetParams/AddStickerToSetParams):stickeraccepts a file (Buffer / stream / local path) which is uploaded as anattach://sticker<i>multipart part, or a file_id / URL string which passes through unchanged._buildStickerItems()mirrors the existing_buildMediaItems()(sendMediaGroup/sendPaidMedia).InputStickerInput(the docs-faithfulInputStickerwithstickerwidened toInputFile), following the same unexported pattern asSendMediaGroupMedia.Breaking change
Both public method signatures change from the old positional form (
createNewStickerSet(userId, name, title, pngSticker, emojis, ...)) to a single options object. Documented under Breaking in the CHANGELOG. Under semver this warrants a major bump.Tests / verification
npm run typecheckclean;npm run buildclean (declarations reference the new type correctly).test/unit/telegram.test.ts): 45/45 pass, incl. 3 new (attach:// wiring, file_id passthrough -> urlencoded, single-object serialization).Notes / follow-up (out of scope)
replaceStickerInSetstill routes through_formand does not upload a file-bearingInputSticker.stickerviaattach://(only file_id / URL works there). Same root cause; could be fixed with the same_buildStickerItemshelper in a follow-up.🤖 Generated with Claude Code