Skip to content

Support Bot API 9.6 types#14

Open
Leask wants to merge 10 commits into
telegraf:masterfrom
Leask:bot-api-9.6-sync
Open

Support Bot API 9.6 types#14
Leask wants to merge 10 commits into
telegraf:masterfrom
Leask:bot-api-9.6-sync

Conversation

@Leask
Copy link
Copy Markdown

@Leask Leask commented May 5, 2026

Summary

  • updates @telegraf/types to Bot API 9.6
  • adds Bot API 9.3-9.6 methods, objects, fields, and parameter changes
  • preserves existing keyboard button aliases while adding managed bot keyboard support
  • tightens Bot API 9.6 details for date_time entities, getMe-only bot management fields, and prepared keyboard buttons

Validation

  • deno fmt --check manage.ts markup.ts message.ts methods.ts update.ts
  • deno lint
  • deno task check
  • npm pack --dry-run
  • compared methods against the live Telegram Bot API docs: 169 official methods, 169 typed methods, no missing or extra methods

Notes

  • .github/workflows/release.yml is formatted so full-repo deno fmt --check passes.

MadL0rd and others added 7 commits May 5, 2026 12:20
- 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
@Leask Leask marked this pull request as ready for review May 5, 2026 17:17
Copilot AI review requested due to automatic review settings May 5, 2026 17:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_time entities, 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 from looks detached: there is a “Sender of the message…” comment that isn’t immediately attached to any field, and from ends up undocumented. Consider moving that comment to the from property.
    /** 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.

Comment thread manage.ts Outdated
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 */
Comment thread manage.ts Outdated
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 */
Comment thread manage.ts Outdated
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 */
Comment thread manage.ts Outdated
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 */
Comment thread methods.ts
Comment on lines 231 to 236
/** Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. */
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;
Comment thread methods.ts
Comment on lines 273 to 278
/** Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. */
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;
Comment thread .github/workflows/release.yml Outdated
Comment on lines +13 to +21
- 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 }}
Comment thread message.ts
Comment on lines +719 to +725
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants