@grammyjs/types 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.d.ts CHANGED
@@ -15,7 +15,7 @@ All queries must be made using UTF-8. */
15
15
  export type ApiResponse<T> = ApiError | ApiSuccess<T>;
16
16
  /** Describes why a request was unsuccessful. */
17
17
  export interface ResponseParameters {
18
- /** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
18
+ /** The group has been migrated to a supergroup with the specified identifier. */
19
19
  migrate_to_chat_id?: number;
20
20
  /** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */
21
21
  retry_after?: number;
package/inline.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Chat, User } from "./manage.js";
2
2
  import type { InlineKeyboardMarkup, WebAppInfo } from "./markup.js";
3
- import type { Location, MessageEntity, ParseMode } from "./message.js";
3
+ import type { LinkPreviewOptions, Location, MessageEntity, ParseMode } from "./message.js";
4
4
  import type { LabeledPrice } from "./payment.js";
5
5
  /** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */
6
6
  export interface InlineQuery {
@@ -573,8 +573,8 @@ export interface InputTextMessageContent {
573
573
  parse_mode?: ParseMode;
574
574
  /** List of special entities that appear in message text, which can be specified instead of parse_mode */
575
575
  entities?: MessageEntity[];
576
- /** Disables link previews for links in the sent message */
577
- disable_web_page_preview?: boolean;
576
+ /** Link preview generation options for the message */
577
+ link_preview_options?: LinkPreviewOptions;
578
578
  }
579
579
  /** Represents the content of a location message to be sent as the result of an inline query. */
580
580
  export interface InputLocationMessageContent {
package/manage.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Location, Message, PhotoSize } from "./message.js";
1
+ import type { Location, Message, PhotoSize, ReactionType } from "./message.js";
2
2
  import type { Update } from "./update.js";
3
3
  /** Describes the current status of a webhook. */
4
4
  export interface WebhookInfo {
@@ -23,7 +23,7 @@ export interface WebhookInfo {
23
23
  }
24
24
  /** This object represents a Telegram user or bot. */
25
25
  export interface User {
26
- /** Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
26
+ /** Unique identifier for this user or bot. */
27
27
  id: number;
28
28
  /** True, if this user is a bot */
29
29
  is_bot: boolean;
@@ -54,7 +54,7 @@ export interface UserFromGetMe extends User {
54
54
  export declare namespace Chat {
55
55
  /** Internal type holding properties that all kinds of chats share. */
56
56
  interface AbstractChat {
57
- /** Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
57
+ /** Unique identifier for this chat. */
58
58
  id: number;
59
59
  /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
60
60
  type: string;
@@ -103,35 +103,44 @@ export declare namespace Chat {
103
103
  has_protected_content?: true;
104
104
  }
105
105
  /** Internal type holding properties that those private, supergroup, and channel chats returned from `getChat` share. */
106
- interface NonGroupGetChat extends GetChat {
106
+ interface NonGroupGetChat {
107
107
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */
108
108
  active_usernames?: string[];
109
109
  }
110
110
  /** Internal type holding properties that those group, supergroup, and channel chats returned from `getChat` share. */
111
- interface NonPrivateGetChat extends GetChat {
111
+ interface NonPrivateGetChat {
112
112
  /** Description, for groups, supergroups and channel chats. Returned only in getChat. */
113
113
  description?: string;
114
114
  /** Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */
115
115
  invite_link?: string;
116
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat. */
117
+ available_reactions?: ReactionType[];
116
118
  }
117
119
  /** Internal type holding properties that those group and supergroup chats returned from `getChat` share. */
118
- interface MultiUserGetChat extends NonPrivateGetChat {
120
+ interface MultiUserGetChat {
119
121
  /** Default chat member permissions, for groups and supergroups. Returned only in getChat. */
120
122
  permissions?: ChatPermissions;
121
123
  /** True, if the bot can change the group sticker set. Returned only in getChat. */
122
124
  can_set_sticker_set?: true;
123
125
  }
126
+ /** Internal type holding properties that those private and channel chats returned from `getChat` share. */
127
+ interface NonMultiUserGetChat {
128
+ /** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. */
129
+ accent_color_id: number;
130
+ /** Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat. */
131
+ background_custom_emoji_id?: string;
132
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in getChat. */
133
+ emoji_status_custom_emoji_id?: string;
134
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any. Returned only in getChat. */
135
+ emoji_status_expiration_date?: number;
136
+ }
124
137
  /** Internal type holding properties that those supergroup and channel chats returned from `getChat` share. */
125
- interface LargeGetChat extends NonPrivateGetChat {
126
- /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. */
138
+ interface LargeGetChat {
139
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. Returned only in getChat. */
127
140
  linked_chat_id?: number;
128
141
  }
129
142
  /** Internal type representing private chats returned from `getChat`. */
130
- interface PrivateGetChat extends PrivateChat, NonGroupGetChat, GetChat {
131
- /** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
132
- emoji_status_custom_emoji_id?: string;
133
- /** Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. */
134
- emoji_status_expiration_date?: number;
143
+ interface PrivateGetChat extends PrivateChat, GetChat, NonGroupGetChat, NonMultiUserGetChat {
135
144
  /** Bio of the other party in a private chat. Returned only in getChat. */
136
145
  bio?: string;
137
146
  /** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. */
@@ -140,16 +149,18 @@ export declare namespace Chat {
140
149
  has_restricted_voice_and_video_messages?: true;
141
150
  }
142
151
  /** Internal type representing group chats returned from `getChat`. */
143
- interface GroupGetChat extends GroupChat, MultiUserGetChat {
152
+ interface GroupGetChat extends GroupChat, GetChat, NonPrivateGetChat, MultiUserGetChat {
144
153
  }
145
154
  /** Internal type representing supergroup chats returned from `getChat`. */
146
- interface SupergroupGetChat extends SupergroupChat, NonGroupGetChat, MultiUserGetChat, LargeGetChat {
155
+ interface SupergroupGetChat extends SupergroupChat, GetChat, NonGroupGetChat, NonPrivateGetChat, MultiUserGetChat, LargeGetChat {
147
156
  /** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
148
157
  join_to_send_messages?: true;
149
158
  /** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */
150
159
  join_by_request?: true;
151
160
  /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
152
161
  slow_mode_delay?: number;
162
+ /** True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat. */
163
+ has_visible_history?: boolean;
153
164
  /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */
154
165
  has_aggressive_anti_spam_enabled?: true;
155
166
  /** For supergroups, name of group sticker set. Returned only in getChat. */
@@ -158,7 +169,11 @@ export declare namespace Chat {
158
169
  location?: ChatLocation;
159
170
  }
160
171
  /** Internal type representing channel chats returned from `getChat`. */
161
- interface ChannelGetChat extends ChannelChat, NonGroupGetChat, LargeGetChat {
172
+ interface ChannelGetChat extends ChannelChat, GetChat, NonGroupGetChat, NonPrivateGetChat, NonMultiUserGetChat, LargeGetChat {
173
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat. */
174
+ profile_accent_color_id?: number;
175
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat. */
176
+ profile_background_custom_emoji_id?: string;
162
177
  }
163
178
  }
164
179
  /** This object represents a chat. */
@@ -237,6 +252,23 @@ export interface ChatAdministratorRights {
237
252
  /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
238
253
  can_manage_topics?: boolean;
239
254
  }
255
+ /** This object represents changes in the status of a chat member. */
256
+ export interface ChatMemberUpdated {
257
+ /** Chat the user belongs to */
258
+ chat: Chat;
259
+ /** Performer of the action, which resulted in the change */
260
+ from: User;
261
+ /** Date the change was done in Unix time */
262
+ date: number;
263
+ /** Previous information about the chat member */
264
+ old_chat_member: ChatMember;
265
+ /** New information about the chat member */
266
+ new_chat_member: ChatMember;
267
+ /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
268
+ invite_link?: ChatInviteLink;
269
+ /** True, if the user joined the chat via a chat folder invite link */
270
+ via_chat_folder_invite_link?: boolean;
271
+ }
240
272
  /** This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
241
273
  - ChatMemberOwner
242
274
  - ChatMemberAdministrator
@@ -312,7 +344,7 @@ export interface ChatMemberRestricted {
312
344
  user: User;
313
345
  /** True, if the user is a member of the chat at the moment of the request */
314
346
  is_member: boolean;
315
- /** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
347
+ /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
316
348
  can_send_messages: boolean;
317
349
  /** True, if the user is allowed to send audios */
318
350
  can_send_audios: boolean;
@@ -359,30 +391,13 @@ export interface ChatMemberBanned {
359
391
  /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever */
360
392
  until_date: number;
361
393
  }
362
- /** This object represents changes in the status of a chat member. */
363
- export interface ChatMemberUpdated {
364
- /** Chat the user belongs to */
365
- chat: Chat;
366
- /** Performer of the action, which resulted in the change */
367
- from: User;
368
- /** Date the change was done in Unix time */
369
- date: number;
370
- /** Previous information about the chat member */
371
- old_chat_member: ChatMember;
372
- /** New information about the chat member */
373
- new_chat_member: ChatMember;
374
- /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
375
- invite_link?: ChatInviteLink;
376
- /** True, if the user joined the chat via a chat folder invite link */
377
- via_chat_folder_invite_link?: boolean;
378
- }
379
394
  /** Represents a join request sent to a chat. */
380
395
  export interface ChatJoinRequest {
381
396
  /** Chat to which the request was sent */
382
397
  chat: Chat.SupergroupChat | Chat.ChannelChat;
383
398
  /** User that sent the join request */
384
399
  from: User;
385
- /** Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. */
400
+ /** Identifier of a private chat with the user who sent the join request. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. */
386
401
  user_chat_id: number;
387
402
  /** Date the request was sent in Unix time */
388
403
  date: number;
@@ -393,7 +408,7 @@ export interface ChatJoinRequest {
393
408
  }
394
409
  /** Describes actions that a non-administrator user is allowed to take in a chat. */
395
410
  export interface ChatPermissions {
396
- /** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
411
+ /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
397
412
  can_send_messages?: boolean;
398
413
  /** True, if the user is allowed to send audios */
399
414
  can_send_audios?: boolean;
@@ -447,14 +462,64 @@ export interface BotCommand {
447
462
  /** Description of the command; 1-256 characters. */
448
463
  description: string;
449
464
  }
450
- /** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. */
451
- export interface File {
452
- /** Identifier for this file, which can be used to download or reuse the file */
453
- file_id: string;
454
- /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
455
- file_unique_id: string;
456
- /** File size in bytes */
457
- file_size?: number;
458
- /** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
459
- file_path?: string;
465
+ /** This object describes the source of a chat boost. It can be one of
466
+
467
+ - ChatBoostSourcePremium
468
+ - ChatBoostSourceGiftCode
469
+ - ChatBoostSourceGiveaway */
470
+ export type ChatBoostSource = ChatBoostSourcePremium | ChatBoostSourceGiftCode | ChatBoostSourceGiveaway;
471
+ /** The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. */
472
+ export interface ChatBoostSourcePremium {
473
+ /** Source of the boost, always “premium” */
474
+ source: "premium";
475
+ /** User that boosted the chat */
476
+ user: User;
477
+ }
478
+ /** The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */
479
+ export interface ChatBoostSourceGiftCode {
480
+ /** Source of the boost, always “gift_code” */
481
+ source: "gift_code";
482
+ /** User for which the gift code was created */
483
+ user: User;
484
+ }
485
+ /** The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */
486
+ export interface ChatBoostSourceGiveaway {
487
+ /** Source of the boost, always “giveaway” */
488
+ source: "giveaway";
489
+ /** Identifier of a message in the chat with the giveaway; the message could have been deleted already */
490
+ giveaway_message_id: number;
491
+ }
492
+ /** This object contains information about a chat boost. */
493
+ export interface ChatBoost {
494
+ /** Unique identifier of the boost */
495
+ boost_id: string;
496
+ /** Point in time (Unix timestamp) when the chat was boosted */
497
+ add_date: number;
498
+ /** Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged */
499
+ expiration_date: number;
500
+ /** Source of the added boost */
501
+ source: ChatBoostSource;
502
+ }
503
+ /** This object represents a boost added to a chat or changed. */
504
+ export interface ChatBoostUpdated {
505
+ /** Chat which was boosted */
506
+ chat: Chat;
507
+ /** Infomation about the chat boost */
508
+ boost: ChatBoost;
509
+ }
510
+ /** This object represents a boost removed from a chat. */
511
+ export interface ChatBoostRemoved {
512
+ /** Chat which was boosted */
513
+ chat: Chat;
514
+ /** Unique identifier of the boost */
515
+ boost_id: string;
516
+ /** Point in time (Unix timestamp) when the boost was removed */
517
+ remove_date: number;
518
+ /** Source of the removed boost */
519
+ source: ChatBoostSource;
520
+ }
521
+ /** This object represents a list of boosts added to a chat by a user. */
522
+ export interface UserChatBoosts {
523
+ /** The list of boosts added to the chat by the user */
524
+ boosts: ChatBoost[];
460
525
  }
package/markup.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ChatAdministratorRights, User } from "./manage.js";
2
- import type { Message } from "./message.js";
2
+ import type { MaybeInaccessibleMessage } from "./message.js";
3
3
  /** This object represents an inline keyboard that appears right next to the message it belongs to. */
4
4
  export interface InlineKeyboardMarkup {
5
5
  /** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
@@ -93,8 +93,8 @@ export interface CallbackQuery {
93
93
  id: string;
94
94
  /** Sender */
95
95
  from: User;
96
- /** Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old */
97
- message?: Message;
96
+ /** Message sent by the bot with the callback button that originated the query */
97
+ message?: MaybeInaccessibleMessage;
98
98
  /** Identifier of the message sent via the bot in inline mode, that originated the query. */
99
99
  inline_message_id?: string;
100
100
  /** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */
@@ -126,9 +126,9 @@ export declare namespace KeyboardButton {
126
126
  /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
127
127
  text: string;
128
128
  }
129
- interface RequestUserButton extends CommonButton {
130
- /** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
131
- request_user: KeyboardButtonRequestUser;
129
+ interface RequestUsersButton extends CommonButton {
130
+ /** If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */
131
+ request_users: KeyboardButtonRequestUsers;
132
132
  }
133
133
  interface RequestChatButton extends CommonButton {
134
134
  /** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
@@ -151,8 +151,8 @@ export declare namespace KeyboardButton {
151
151
  web_app: WebAppInfo;
152
152
  }
153
153
  }
154
- /** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
155
- export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUserButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string;
154
+ /** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_users, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
155
+ export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUsersButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string;
156
156
  /** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
157
157
  export interface KeyboardButtonPollType {
158
158
  /** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
@@ -189,14 +189,16 @@ export interface WebAppInfo {
189
189
  /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
190
190
  url: string;
191
191
  }
192
- /** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. */
193
- export interface KeyboardButtonRequestUser {
194
- /** Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message */
192
+ /** This object defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed. */
193
+ export interface KeyboardButtonRequestUsers {
194
+ /** Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message */
195
195
  request_id: number;
196
- /** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
196
+ /** Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied. */
197
197
  user_is_bot?: boolean;
198
- /** Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
198
+ /** Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied. */
199
199
  user_is_premium?: boolean;
200
+ /** The maximum number of users to be selected; 1-10. Defaults to 1. */
201
+ max_quantity?: boolean;
200
202
  }
201
203
  /** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */
202
204
  export interface KeyboardButtonRequestChat {