Added
-
request.fetchandrequest.fetchOptionsoptions (on theTelegramBot
constructor /HttpClient), for per-instance transport customization. Pass a
customfetchimplementation (e.g. undici'sfetchbound to aProxyAgent),
or extra fetch init such as an undicidispatcher, scoped to a single bot
instance - nosetGlobalDispatcher, so other clients in the process are
unaffected. This restores the per-instance proxy capability that the legacy
request.agentprovided before the move to the built-infetch. (#1319)import TelegramBot from "node-telegram-bot-api"; import { ProxyAgent } from "undici"; const bot = new TelegramBot(token, { polling: true, request: { fetchOptions: { dispatcher: new ProxyAgent("http://127.0.0.1:8080") } }, });
Fixed
-
editMessageMedianow accepts a Buffer / stream / local file path for the new
media(and itsthumbnail/cover), uploading it via anattach://part -
previously only a file_id / URL or the legacyattach://<local-path>form
worked. Resolved through the same_buildMediaItemspipeline as
sendMediaGroup; string callers and the oldattach://<local-path>form are
unaffected.
(#1189) -
Breaking:
createNewStickerSetandaddStickerToSetwere still sending the
long-removedpng_sticker/emojisfields, which Telegram rejects with
400 Bad Request: invalid sticker emojis. They now use the current Bot API
shape - a single options object carryingstickers: InputSticker[](or a single
sticker: InputSticker), where each sticker's file (Buffer / stream / local
path) is uploaded via anattach://part, while a file_id / URL string passes
through unchanged.
(#1236)// Before (broken): bot.createNewStickerSet(userId, name, title, pngSticker, "😀"); // After: bot.createNewStickerSet({ user_id: userId, name, title, stickers: [{ sticker: "./a.png", format: "static", emoji_list: ["😀"] }], }); bot.addStickerToSet({ user_id: userId, name, sticker: { sticker: "./b.webp", format: "static", emoji_list: ["🎈"] }, });