Repository navigation
Support Bot API 10.5 - #1402
Support Bot API 10.5#1402
Conversation
Regenerate types and Api for setMySettings, BotFullInfo, WriteAccessAllowed.inviter and the blocks-based expandable quotations. getMe now returns BotFullInfo, so bot.botInfo and ctx.me are retyped, and RichMessageBuilder.expandableBlockquote takes nested blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With Bot API 10.5 callback_query_mode, presses on the bot's own messages can carry only inline_message_id. Note it in matchCallback, ctx.reply, the README and the CHANGELOG, and let the paging example edit through inline_message_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Verified live: with topics off, setMySettings({ has_topic_sidebar: true })
returns true but getMe keeps reporting false.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the MR. Two small requests before this lands - both follow-up-sized, but since the PR is already touching these spots: 1. Make The field is a prose enum we deliberately keep /** Every documented callback_query_mode value, typo-proof versus raw strings. */
export const CallbackQueryMode = {
Default: "default",
Auto: "auto",
Inline: "inline",
} as const;
export type CallbackQueryMode = (typeof CallbackQueryMode)[number];Then 2. The |
CallbackQueryMode (Default / Auto / Inline) is hand-curated in the generator's PRELUDE next to ParseMode and emitted into schemas.ts. callback_query_mode stays string. The generator checks the docs' "Must be one of ..." sentence for setMySettings.callback_query_mode on every run and fails if the listed modes differ from the const. Also type ctx.me as BotFullInfo in test/unit/bot.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Both are in 0f58fb1.
Thanks for opening #1403; I dropped the question from the description and linked the issue instead.
I'm marking the PR ready for review. The client tables in the description show how the apps rendered on release day; I will re-test and update them when the apps ship 10.5 support, without blocking the merge. |
|
The phrase-check turned out to be more than we want - that one's on me, it was the optional half of my ask. Let's keep the const exactly like Concretely, please drop from
/** Every documented `callback_query_mode` value, typo-proof versus raw strings. */
export const CallbackQueryMode = {
Default: "default",
Auto: "auto",
Inline: "inline",
} as const;
export type CallbackQueryMode = (typeof CallbackQueryMode)[keyof typeof CallbackQueryMode];Keep everything else exactly as it is - the Rationale, for the record: |
Write CallbackQueryMode as a plain literal in the PRELUDE, like ParseMode, and remove checkCallbackQueryModes() with its flag, call site and guard. Generated output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Sorry for jumping the gun Done in a8dd452: the check, its flag, call site and guard are gone, One thing I noticed while regenerating: the docs have been reworded since November 22. The edit methods now say "the edited Message is returned; otherwise, True is returned", and the return-type rule at Also, Telegram Desktop 7.4.6 now renders the rich expandable quote collapsed; I updated that cell in the description. |
|
Verified a8dd452 - both items are exactly as requested:
The docs drift is real and exactly as you described it - I reproduced it independently: the fresh generator run narrows those seven edit methods from From my side this is ready to merge, apart from whatever CI confirms. Nice work on the manual client tables. |
npm run checkis clean (typecheck src + test + examples,lint:core,check:edge, unit suite)npm run buildis cleansrc/types/schemas.tsandsrc/core/api.tscome fromnpm run generate:types; never hand-edit)Description
Adds support for Bot API 10.5 (November 22, 2026).
Regenerated
src/types/schemas.tsandsrc/core/api.tswithbun scripts/api-parser.ts. The run was clean: no unmapped types and no return-type fallbacks.Breaking changes
Both follow breaking changes in Bot API 10.5 itself. Both are marked Breaking in the CHANGELOG.
API surface compared with
master:setMySettingsadded); 3 types added (BotFullInfo,SetMySettingsParams,SetMySettingsResult), none removed; one const + type added (CallbackQueryMode, from the generator'sPRELUDE); one return type changed (GetMeResult:User->BotFullInfo); 10 fields removed fromUser;text->blocksin the two expandable-quotation types;inviteradded toWriteAccessAllowed. Nothing else removed or retyped.bot.botInfo,ctx.meand theContextconstructor'smeprovider are typedBotFullInfo;RichMessageBuilder.expandableBlockquote(text, credit?)->expandableBlockquote(blocks, credit?).1. Bot-only fields removed from
UsergetMenow returns the newBotFullInfo. The fields that onlygetMeever filled (can_join_groups,can_read_all_group_messages,supports_inline_queries,supports_guest_queries,can_connect_to_business,has_main_web_app,has_topics_enabled,allows_users_to_create_topics,can_manage_bots,supports_join_request_queries) are no longer onUser.Not affected:
const me: User = await bot.api.getMe()still compiles (BotFullInfois assignable toUser), andbot.botInfo/ctx.meare now typedBotFullInfo, so reading these fields from them keeps working.2. Expandable block quotations take blocks, not text
RichBlockExpandableBlockQuotationandInputRichBlockExpandableBlockQuotationreplacetextwithblocks.RichMessageBuilder.expandableBlockquotefollows the wire format and now has the same signature asblockquote.A plain-JS caller that still passes a string sends
blocks: "Long text", which Telegram rejects with a 400. I did not add a fallback that wraps a string in a paragraph; easy to add if you want one.Upgrade checklist
can_join_groups,supports_inline_queries, ...) from aUser: read it fromgetMe(),bot.botInfoorctx.meinstead, typedBotFullInfo.getMe()result asUserkeeps compiling; change it toBotFullInfoto see the new fields.expandableBlockquote("text", credit)->expandableBlockquote((b) => b.paragraph("text"), credit); a literal{ type: "expandable_blockquote", text }->{ type: "expandable_blockquote", blocks: [...] }.callback_query_modeto "auto" or "inline": handle presses withoutmessage(see below).What's new
setMySettings- new method to change bot settings: inline mode, privacy mode, joining groups, topics in private chats, topic sidebar,callback_query_mode.has_topic_sidebartakes effect only whilehas_topics_enabledis on: with topics off,setMySettings({ has_topic_sidebar: true })returnstruebutgetMekeeps reportingfalse(checked live; noted in the CHANGELOG).BotFullInfo- returned bygetMe, with newactive_usernames,inline_query_placeholder,needs_inline_query_location,has_topic_sidebar.CallbackQueryMode- a typo-proof const forcallback_query_mode, hand-curated inPRELUDEnext toParseMode:await api.setMySettings({ callback_query_mode: CallbackQueryMode.Inline }). The field staysstring, so plain strings keep compiling, and theCallbackQueryModetype alias gives the union. LikeParseMode, it is hand-curated: a future fourth mode needs aPRELUDEedit, and plain strings keep working until then.callback_query_mode- with "auto" or "inline", presses on the bot's own messages can arrive withinline_message_idinstead ofmessage. No type change (messagewas already optional), but for those pressesctx.chatisundefined,ctx.replythrows, andmatchCallbackdoes not match. Documented in thematchCallbackcomment, thectx.replydoc, the README reply-tracking section, and the CHANGELOG;examples/17-callback-tracking.tsnow edits throughinline_message_idwhenmessageis absent. Only bots that opt in are affected.WriteAccessAllowed.inviter- for users the owner invites witht.me/botinvite/<bot>. The link needs a client that knows it; per the lumex v2.5.0 release notes, an older one readsbotinviteas a username and says the user does not exist.Hand-work beyond regeneration
scripts/api-parser.ts:RETURN_OVERRIDES.getMeis nowBotFullInfo;CallbackQueryModeinPRELUDE/PRELUDE_NAMES.src/core/bot.ts,src/core/context.ts:bot.botInfoandctx.metypedBotFullInfo.src/core/richmessage.ts:expandableBlockquotetakes nested blocks.src/core/reply-tracking.ts,src/core/context.ts,README.md,examples/17-callback-tracking.ts: thecallback_query_modenotes above.test/unit/builders.test.ts:expandableBlockquotewire shape.test/unit/serialize.test.ts:CallbackQueryModeis exported from the package root and serializes as its plain string.test/unit/bot.test.ts:ctx.meis asserted asBotFullInfo.test/e2e/methods.test.ts:setMySettingsdescribe (writes back the currenthas_topic_sidebar, so nothing changes);getMeassertshas_topic_sidebar.doc/api.md.Verification
npm run check: green (309 Bun unit tests).npm run test:node:unit: 286 pass on Node 26.npm run build: green.getMeandsetMySettings, against api.telegram.org with a throwaway bot: 2 pass.Manual tests on production with a small script on this branch. Clients: Telegram for Android 13.3.1 (official Play Store app), Telegram X for Android 0.29.2.1832 (built November 18, before 10.5), Telegram Desktop 7.4.4, Web K, Web A, Telegram for iOS (latest from the App Store on the test day, exact version unknown). "Bot API" is what the API returned to the bot.
getMe/BotFullInfoBotFullInfowithactive_usernames,has_topic_sidebar,needs_inline_query_location, andinline_query_placeholderwhen setsetMySettings-has_topics_enabled+has_topic_sidebargetMereflects both valuessetMySettings-supports_inline_queries+inline_query_placeholdergetMereturns the placeholder@botsetMySettings-callback_query_mode: "inline"inline_message_id;editMessageText({ inline_message_id })edits the messageanswerCallbackQueryalert shown)Expandable block quotation with
blocksexpandable_blockquotewith the nested blocks and creditIn every client that renders rich messages, a classic
expandable_blockquoteentity in the same chat renders collapsed, so the expanded rendering is on the client side. Desktop 7.4.6 now collapses the rich one too.WriteAccessAllowed.inviter(t.me/botinvite)The invite cannot be repeated for the same user (deleting the chat or block/unblock still gives "already has a chat"), so I could not retry the Bot API side.
Notes
inviterwas verified against the Bot API itself (the "Bot API" column;invitercould not be retried, see its table). The other columns show how the apps rendered it on November 22, the day 10.5 came out, before most of them supported it (see the expandable quote row). I will repeat the client tests when the apps ship 10.5 support and update the tables; that does not block review.sendWidgetreturnsBad Request: INPUT_MEDIA_WIDGET_NOT_ALLOWEDfor general bots, even in a private chat (tdlib/telegram-bot-api#947). On 2026-11-21 the TDLib maintainer wrote that it is unknown whether general bots will be allowed again, and that there is no way to apply. So the widget e2e blocks intest/e2e/methods.test.tsfail regardless of this branch.ctx.editMessageTextshortcut for presses withoutmessageis tracked in Add a ctx.editMessageText shortcut for presses that arrive without message (callback_query_mode) #1403.ctx.replystill throws for a press withoutmessage. Falling back to the presser's chat would be right in a private chat but wrong in a group, so I kept the throw.References