Repository navigation
Conversation
- add has_topics_enabled in getMe user - add sendMessageDraft method - update Message topic field wording - widen message_thread_id docs for send methods - update sendChatAction topic wording - mention private chats in topic admin methods - add is_name_implicit topic fields - add getUserGifts and getChatGifts - replace UniqueGiftInfo resale fields - split getBusinessAccountGifts limited filters - add gifted_upgrade origin value - add offer origin value - add message.gift_upgrade_sent service type - add UniqueGift.gift_id - add UniqueGift.is_from_blockchain - add getBusinessAccountGifts blockchain filter - add personal gift quota fields - add premium markers for gifts - add is_upgrade_separate fields - add UniqueGiftColors type - add Gift.has_colors - add UniqueGift.colors - add GiftBackground and Gift.background - add Gift.unique_gift_variant_count - add unique_gift_number fields - add AcceptedGiftTypes.gifts_from_channels - add repostStory method - add UserRating and chat rating field - add ChatFullInfo.paid_message_star_count - add message_effect_id to forward/copy - add ChatFullInfo.unique_gift_colors - add ChecklistTask.completed_by_chat
- update createForumTopic private chat support - add allows_users_to_create_topics - add icon_custom_emoji_id to buttons - add button style field - add ChatOwnerLeft message type - add ChatOwnerChanged message type - add bot profile photo methods - add VideoQuality and video qualities - add ChatFullInfo.first_profile_audio - add UserProfileAudios and getter - add UniqueGiftModel.rarity - add UniqueGift.is_burned
There was a problem hiding this comment.
Pull request overview
Updates @telegraf/types to align with Telegram Bot API 9.6 by adding/adjusting API method typings and the corresponding object/update/message type definitions.
Changes:
- Add Bot API 9.3–9.6 updates, including managed-bot updates and prepared keyboard button support.
- Extend message/model types (e.g., poll option persistence,
date_timeentities, video qualities, tags, gift fields). - Bump published package version and update the README Bot API badge.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
update.ts |
Adds managed_bot update variant to the Update union. |
methods.ts |
Adds/updates Bot API methods and parameter docs for 9.6 (incl. managed bot token methods, profile audios, prepared keyboard button saving, etc.). |
message.ts |
Extends message/service-message unions and message-related objects/entities for 9.6. |
markup.ts |
Adds managed-bot keyboard request button support and prepared keyboard button type. |
manage.ts |
Adds/updates management and chat/user-related types for 9.6 (managed bots, tags, ratings, gifts, etc.). |
README.md |
Updates the Bot API version badge to v9.6. |
package.json |
Bumps package version to 9.6.0. |
package-lock.json |
Aligns lockfile package version to 9.6.0. |
.github/workflows/release.yml |
Reformats workflow steps (not mentioned in PR summary). |
Comments suppressed due to low confidence (1)
message.ts:28
- The JSDoc for
fromlooks detached: there is a “Sender of the message…” comment that isn’t immediately attached to any field, andfromends up undocumented. Consider moving that comment to thefromproperty.
/** Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only */
message_thread_id?: number;
/** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
/** Information about the direct messages chat topic that contains the message */
direct_messages_topic?: DirectMessagesTopic;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pinned_message?: Message; | ||
| /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */ | ||
| accepted_gift_types?: AcceptedGiftTypes[]; | ||
| /** The number of Telegram Stars a general user have to pay to send a message to the chat */ |
| permissions?: ChatPermissions; | ||
| /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */ | ||
| accepted_gift_types?: AcceptedGiftTypes[]; | ||
| /** The number of Telegram Stars a general user have to pay to send a message to the chat */ |
| permissions?: ChatPermissions; | ||
| /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */ | ||
| accepted_gift_types?: AcceptedGiftTypes[]; | ||
| /** The number of Telegram Stars a general user have to pay to send a message to the chat */ |
| pinned_message?: Message; | ||
| /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */ | ||
| accepted_gift_types?: AcceptedGiftTypes[]; | ||
| /** The number of Telegram Stars a general user have to pay to send a message to the chat */ |
| @@ -227,7 +232,7 @@ export type ApiMethods<F> = { | |||
| copyMessage(args: { | |||
| /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ | |||
| chat_id: number | string; | |||
| /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ | |||
| /** Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only */ | |||
| message_thread_id?: number; | |||
| @@ -267,7 +274,7 @@ export type ApiMethods<F> = { | |||
| copyMessages(args: { | |||
| /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */ | |||
| chat_id: number | string; | |||
| /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ | |||
| /** Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only */ | |||
| message_thread_id?: number; | |||
| - uses: actions/checkout@v3 | ||
| - run: npm ci --ignore-scripts | ||
| - run: npm run prepare | ||
| - name: Publish to npm | ||
| run: | | ||
| npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | ||
| npm publish --ignore-scripts --access=public | ||
| env: | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| export interface DateTime extends Abstract { | ||
| type: "date_time"; | ||
| /** Unix time associated with the entity */ | ||
| unix_time?: number; | ||
| /** String that defines the formatting of the date and time */ | ||
| date_time_format?: string; | ||
| } |
Preserve the unified documentation-ordered bot-api.ts layout and tsc/Bun tooling. Port reviewed 10.3 contracts and verify all 185 methods and 399 objects against the official snapshot, plus source and declaration compiler fixtures. Co-authored-by: siakinnik <siakin.nikita@siakinnik.com>
|
Updated this PR to Bot API 10.3 in The implementation follows the new upstream direction: one documentation-ordered An independent Telegram documentation snapshot checks all 185 methods and 399 object definitions, including parameter/field names, optionality and primitive types. Positive/negative examples compile against both source and isolated generated declarations. These checks intentionally do not claim to validate every prose-only Telegram constraint. Fork CI passes on Node 20, 22, 24 and 26. Tests, type checking, lint, formatting, frozen install and declaration-only package dry-run all pass. The runtime companion telegraf/telegraf#2092 now uses this exact commit and covers all 185 methods; its Node 22.20/24.12/26 CI passes as well. The temporary HTTPS pin remains a release gate until the official 10.3 package is published. The version is prepared as 10.3.0, but no npm publication was performed. |
|
Cross-review of #13 and #17 identified two additional constraints to track on this PR at
I reproduced both with TypeScript 6.0.3 strict probes using No fix for these two findings is claimed in this review pass. I have highlighted the corresponding benefit of #17 in its review rather than recommend replacing it wholesale with #14. This does not change the verified method/field coverage or CI results, but it does qualify the remaining payload-constraint work before release. |
Adopt the inline InputRichMessage<never> constraint highlighted by MKRhere in telegraf#17 and apply the documented upload restriction to sendRichMessageDraft. Add source and declaration regression contracts, including plain styled reply buttons and ephemeral rich Opts.
Pin the tested types follow-up from telegraf/types#14, incorporating the inline restriction from telegraf#17. Keep file uploads for non-inline and ephemeral edits, narrow Context targets, reject uploads in drafts and inline edits, and cover the public compiler contracts without changing request serialization.
|
Follow-up to the cross-PR comparison: both upload gaps are fixed in 88aa916.
Types CI passes on Node 20, 22, 24, and 26. The matching Telegraf commit in telegraf/telegraf#2092 pins this exact types commit and propagates the constraints into Telegram/Context. It passes all 290 local tests and lint, including the previously failing upload regression. Scope remains compile-time upload-object validation: plain strings are not branded file IDs, so URL-string validity still needs to follow Telegram's documentation. No npm publication or upstream merge was performed. |
Summary
Updates the official declarations from Bot API 9.2 to Bot API 10.3, the latest specification published at https://core.telegram.org/bots/api as of October 4, 2026. This also resolves the conflict with the current
masterbranch while preserving its unified, documentation-orderedbot-api.ts, compatibility re-exports, directtscdeclaration build, Bun lockfile, and Oxlint/Oxfmt tooling.The update covers API 9.3 through 10.3: managed bots, rich messages and draft streaming, guest and join-request queries, ephemeral messages, live photos, poll media, communities, subscriptions, reaction moderation, and generation-stopped updates. It incorporates the reviewed contracts from telegraf-hardened/types#6 and #7, with attribution, and preserves the fixes recently merged upstream.
Important contracts include numeric ephemeral IDs and their required receiver; guest replies as
InlineQueryResult; live-photo still/video fields; recursive rich-button text constraints; exclusive optional poll media; and thinking blocks restricted to draft input while allowing completed rich messages to be reused as drafts. File upload types remain generic.Userincludes the documented optional getMe fields, and literal-true response fields are modeled accordingly.Cross-review follow-up: adopts @MKRhere's no-upload generic for inline rich-message edits from #17, and applies the documented restriction to
sendRichMessageDraftas well. Regression contracts cover direct calls,Opts, nested blocks, explicit media, existing file IDs, ordinary chat/ephemeral uploads, plain styled reply buttons, and rich ephemeral edits throughOpts. Ordinary strings are not branded file IDs, so these types do not distinguish all prohibited URL strings from valid file IDs.Validation
npm test: four test groups pass, including positive/negative examples against both source files and isolated generated declarations.InputFiledefinition is represented by the consumer's genericF.bun install --frozen-lockfile --ignore-scripts,npm run check,npm run lint, andnpm run fmt:checkpass.npm pack --dry-run: declaration-only package with the expected public entry points.88aa916on Node 20, 22, 24, and 26 with read-only repository permissions.The snapshot is dated and checked in for deterministic offline validation. These checks do not claim to enforce every prose-only API constraint or replace live Telegram integration testing.
Integration
The package version is prepared as
10.3.0; no package has been published by this PR. Companion telegraf/telegraf#2092 now uses these exact declarations and the latest upstream runtime changes, and preserves the upload restrictions through its Telegram/Context helpers. Its fork CI passes all 290 runtime/type tests and lint on Node 22.20, 24.12, and 26. Its temporary HTTPS dependency pin must be replaced by the official registry release before publication.