@grammyjs/types 3.22.2 → 3.23.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/checklist.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { User } from "./manage.js";
1
+ import type { Chat, User } from "./manage.js";
2
2
  import type { Message, MessageEntity, ParseMode } from "./message.js";
3
3
  /** Describes a task in a checklist. */
4
4
  export interface ChecklistTask {
@@ -8,8 +8,10 @@ export interface ChecklistTask {
8
8
  text: string;
9
9
  /** Special entities that appear in the task text */
10
10
  text_entities?: MessageEntity[];
11
- /** User that completed the task; omitted if the task wasn't completed */
11
+ /** User that completed the task; omitted if the task wasn't completed by a user */
12
12
  completed_by_user?: User;
13
+ /** Chat that completed the task; omitted if the task wasn't completed by a chat */
14
+ completed_by_chat?: Chat;
13
15
  /** Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */
14
16
  completion_date?: number;
15
17
  }
package/inline.d.ts CHANGED
@@ -621,7 +621,7 @@ export interface InputInvoiceMessageContent {
621
621
  description: string;
622
622
  /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. */
623
623
  payload: string;
624
- /** Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. */
624
+ /** Payment provider token, obtained via `@BotFather`. Pass an empty string for payments in Telegram Stars. */
625
625
  provider_token?: string;
626
626
  /** Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. */
627
627
  currency: string;
@@ -658,7 +658,7 @@ export interface InputInvoiceMessageContent {
658
658
  }
659
659
  /** Represents a result of an inline query that was chosen by the user and sent to their chat partner.
660
660
 
661
- Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. */
661
+ Note: It is necessary to enable inline feedback via `@BotFather` in order to receive these objects in updates. */
662
662
  export interface ChosenInlineResult {
663
663
  /** The unique identifier for the result that was chosen */
664
664
  result_id: string;
package/manage.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Location, Message, PhotoSize, ReactionType, Sticker } from "./message.js";
2
+ import type { UniqueGiftColors } from "./payment.js";
2
3
  import type { Update } from "./update.js";
3
4
  /** Describes the current status of a webhook. */
4
5
  export interface WebhookInfo {
@@ -31,6 +32,8 @@ export interface AcceptedGiftTypes {
31
32
  unique_gifts: boolean;
32
33
  /** True, if a Telegram Premium subscription is accepted */
33
34
  premium_subscription: boolean;
35
+ /** True, if transfers of unique gifts from channels are accepted */
36
+ gifts_from_channels: boolean;
34
37
  }
35
38
  /** This object represents a Telegram user or bot. */
36
39
  export interface User {
@@ -65,6 +68,19 @@ export interface UserFromGetMe extends User {
65
68
  can_connect_to_business: boolean;
66
69
  /** True, if the bot has main Web App. Returned only in getMe. */
67
70
  has_main_web_app: boolean;
71
+ /** True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */
72
+ has_topics_enabled?: boolean;
73
+ }
74
+ /** This object describes the rating of a user based on their Telegram Star spendings. */
75
+ export interface UserRating {
76
+ /** Current level of the user, indicating their reliability when purchasing digital goods and services. A higher level suggests a more trustworthy customer; a negative level is likely reason for concern. */
77
+ level: number;
78
+ /** Numerical value of the user's rating; the higher the rating, the better */
79
+ rating: number;
80
+ /** The rating value required to get the current level */
81
+ current_level_rating: number;
82
+ /** The rating value required to get to the next level; omitted if the maximum level was reached */
83
+ next_level_rating?: number;
68
84
  }
69
85
  export declare namespace Chat {
70
86
  /** Internal type for private chats */
@@ -163,6 +179,8 @@ export declare namespace ChatFullInfo {
163
179
  last_name?: string;
164
180
  /** True, if the supergroup chat is a forum (has topics enabled) */
165
181
  is_forum?: undefined;
182
+ /** True, if the chat is the direct messages chat of a channel */
183
+ is_direct_messages?: undefined;
166
184
  /** 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. */
167
185
  accent_color_id: number;
168
186
  /** The maximum number of reactions that can be set on a message in the chat */
@@ -179,8 +197,14 @@ export declare namespace ChatFullInfo {
179
197
  business_location?: BusinessLocation;
180
198
  /** For private chats with business accounts, the opening hours of the business */
181
199
  business_opening_hours?: BusinessOpeningHours;
200
+ /** For private chats, the rating of the user if any */
201
+ rating?: UserRating;
202
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
203
+ unique_gift_colors?: UniqueGiftColors;
182
204
  /** For private chats, the personal channel of the user */
183
205
  personal_chat?: Chat;
206
+ /** Information about the corresponding channel chat; for direct messages chats only */
207
+ parent_chat?: undefined;
184
208
  /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
185
209
  available_reactions?: ReactionType[];
186
210
  /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
@@ -237,8 +261,6 @@ export declare namespace ChatFullInfo {
237
261
  custom_emoji_sticker_set_name?: undefined;
238
262
  /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
239
263
  linked_chat_id?: undefined;
240
- /** Information about the corresponding channel chat; for direct messages chats only */
241
- parent_chat?: undefined;
242
264
  /** For supergroups, the location to which the supergroup is connected */
243
265
  location?: undefined;
244
266
  }
@@ -258,6 +280,8 @@ export declare namespace ChatFullInfo {
258
280
  last_name?: undefined;
259
281
  /** True, if the supergroup chat is a forum (has topics enabled) */
260
282
  is_forum?: undefined;
283
+ /** True, if the chat is the direct messages chat of a channel */
284
+ is_direct_messages?: undefined;
261
285
  /** 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. */
262
286
  accent_color_id: number;
263
287
  /** The maximum number of reactions that can be set on a message in the chat */
@@ -274,8 +298,14 @@ export declare namespace ChatFullInfo {
274
298
  business_location?: undefined;
275
299
  /** For private chats with business accounts, the opening hours of the business */
276
300
  business_opening_hours?: undefined;
301
+ /** For private chats, the rating of the user if any */
302
+ rating?: undefined;
303
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
304
+ unique_gift_colors?: UniqueGiftColors;
277
305
  /** For private chats, the personal channel of the user */
278
306
  personal_chat?: undefined;
307
+ /** Information about the corresponding channel chat; for direct messages chats only */
308
+ parent_chat?: undefined;
279
309
  /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
280
310
  available_reactions?: ReactionType[];
281
311
  /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
@@ -332,8 +362,6 @@ export declare namespace ChatFullInfo {
332
362
  custom_emoji_sticker_set_name?: undefined;
333
363
  /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
334
364
  linked_chat_id?: undefined;
335
- /** Information about the corresponding channel chat; for direct messages chats only */
336
- parent_chat?: undefined;
337
365
  /** For supergroups, the location to which the supergroup is connected */
338
366
  location?: undefined;
339
367
  }
@@ -353,6 +381,8 @@ export declare namespace ChatFullInfo {
353
381
  last_name?: undefined;
354
382
  /** True, if the supergroup chat is a forum (has topics enabled) */
355
383
  is_forum?: true;
384
+ /** True, if the chat is the direct messages chat of a channel */
385
+ is_direct_messages?: true;
356
386
  /** 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. */
357
387
  accent_color_id: number;
358
388
  /** The maximum number of reactions that can be set on a message in the chat */
@@ -369,8 +399,14 @@ export declare namespace ChatFullInfo {
369
399
  business_location?: undefined;
370
400
  /** For private chats with business accounts, the opening hours of the business */
371
401
  business_opening_hours?: undefined;
402
+ /** For private chats, the rating of the user if any */
403
+ rating?: undefined;
404
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
405
+ unique_gift_colors?: UniqueGiftColors;
372
406
  /** For private chats, the personal channel of the user */
373
407
  personal_chat?: undefined;
408
+ /** Information about the corresponding channel chat; for direct messages chats only */
409
+ parent_chat?: Chat.ChannelChat;
374
410
  /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
375
411
  available_reactions?: ReactionType[];
376
412
  /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
@@ -427,8 +463,6 @@ export declare namespace ChatFullInfo {
427
463
  custom_emoji_sticker_set_name?: string;
428
464
  /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
429
465
  linked_chat_id?: number;
430
- /** Information about the corresponding channel chat; for direct messages chats only */
431
- parent_chat?: Chat.ChannelChat;
432
466
  /** For supergroups, the location to which the supergroup is connected */
433
467
  location?: ChatLocation;
434
468
  }
@@ -448,6 +482,8 @@ export declare namespace ChatFullInfo {
448
482
  last_name?: undefined;
449
483
  /** True, if the supergroup chat is a forum (has topics enabled) */
450
484
  is_forum?: undefined;
485
+ /** True, if the chat is the direct messages chat of a channel */
486
+ is_direct_messages?: undefined;
451
487
  /** 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. */
452
488
  accent_color_id: number;
453
489
  /** The maximum number of reactions that can be set on a message in the chat */
@@ -464,8 +500,14 @@ export declare namespace ChatFullInfo {
464
500
  business_location?: undefined;
465
501
  /** For private chats with business accounts, the opening hours of the business */
466
502
  business_opening_hours?: undefined;
503
+ /** For private chats, the rating of the user if any */
504
+ rating?: undefined;
505
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
506
+ unique_gift_colors?: UniqueGiftColors;
467
507
  /** For private chats, the personal channel of the user */
468
508
  personal_chat?: undefined;
509
+ /** Information about the corresponding channel chat; for direct messages chats only */
510
+ parent_chat?: undefined;
469
511
  /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
470
512
  available_reactions?: ReactionType[];
471
513
  /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
@@ -522,8 +564,6 @@ export declare namespace ChatFullInfo {
522
564
  custom_emoji_sticker_set_name?: undefined;
523
565
  /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
524
566
  linked_chat_id?: number;
525
- /** Information about the corresponding channel chat; for direct messages chats only */
526
- parent_chat?: undefined;
527
567
  /** For supergroups, the location to which the supergroup is connected */
528
568
  location?: undefined;
529
569
  }
@@ -853,6 +893,8 @@ export interface ForumTopic {
853
893
  message_thread_id: number;
854
894
  /** Name of the topic */
855
895
  name: string;
896
+ /** True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */
897
+ is_name_implicit?: true;
856
898
  /** Color of the topic icon in RGB format */
857
899
  icon_color: number;
858
900
  /** Unique identifier of the custom emoji shown as the topic icon */
package/markup.d.ts CHANGED
@@ -120,7 +120,7 @@ export interface ReplyKeyboardMarkup {
120
120
  one_time_keyboard?: boolean;
121
121
  /** The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
122
122
  input_field_placeholder?: string;
123
- /** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
123
+ /** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are `@mentioned` in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
124
124
 
125
125
  Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */
126
126
  selective?: boolean;
@@ -166,7 +166,7 @@ export interface KeyboardButtonPollType {
166
166
  export interface ReplyKeyboardRemove {
167
167
  /** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */
168
168
  remove_keyboard: true;
169
- /** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
169
+ /** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are `@mentioned` in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
170
170
 
171
171
  Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */
172
172
  selective?: boolean;
@@ -185,7 +185,7 @@ export interface ForceReply {
185
185
  force_reply: true;
186
186
  /** The placeholder to be shown in the input field when the reply is active; 1-64 characters */
187
187
  input_field_placeholder?: string;
188
- /** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. */
188
+ /** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are `@mentioned` in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. */
189
189
  selective?: boolean;
190
190
  }
191
191
  /** This object represents an inline keyboard button that copies specified text to the clipboard. */
package/message.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare namespace Message {
8
8
  interface ServiceMessage {
9
9
  /** Unique message identifier inside this chat. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent */
10
10
  message_id: number;
11
- /** Unique identifier of a message thread or a forum topic to which the message belongs; for supergroups only */
11
+ /** Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only */
12
12
  message_thread_id?: number;
13
13
  /** Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats */
14
14
  from?: User;
@@ -20,7 +20,7 @@ export declare namespace Message {
20
20
  business_connection_id?: string;
21
21
  /** Chat the message belongs to */
22
22
  chat: Chat;
23
- /** True, if the message is sent to a forum topic */
23
+ /** True, if the message is sent to a topic in a forum supergroup or a private chat with the bot */
24
24
  is_topic_message?: boolean;
25
25
  /** Information about the direct messages chat topic that contains the message */
26
26
  direct_messages_topic?: DirectMessagesTopic;
@@ -141,6 +141,7 @@ export declare namespace Message {
141
141
  type GiveawayCompletedMessage = ServiceMessage & MsgWith<"giveaway_completed">;
142
142
  type GiftMessage = ServiceMessage & MsgWith<"gift">;
143
143
  type UniqueGiftMessage = ServiceMessage & MsgWith<"unique_gift">;
144
+ type GiftUpgradeSentMessage = ServiceMessage & MsgWith<"gift_upgrade_sent">;
144
145
  type PaidMessagePriceChangedMessage = ServiceMessage & MsgWith<"paid_message_price_changed">;
145
146
  type VideoChatScheduledMessage = ServiceMessage & MsgWith<"video_chat_scheduled">;
146
147
  type VideoChatStartedMessage = ServiceMessage & MsgWith<"video_chat_started">;
@@ -274,6 +275,8 @@ export interface Message extends Message.MediaMessage {
274
275
  giveaway_completed?: GiveawayCompleted;
275
276
  /** Service message: a regular gift was sent or received */
276
277
  gift?: GiftInfo;
278
+ /** Service message: upgrade of a gift was purchased after the gift was sent */
279
+ gift_upgrade_sent?: GiftInfo;
277
280
  /** Service message: a unique gift was sent or received */
278
281
  unique_gift?: UniqueGiftInfo;
279
282
  /** Service message: the price for paid messages has changed in the chat */
@@ -370,7 +373,7 @@ Please note:
370
373
  - Inside `pre` and `code` entities, all '`' and '\' characters must be escaped with a preceding '\' character.
371
374
  - Inside the `(...)` part of the inline link and custom emoji definition, all ')' and '\' must be escaped with a preceding '\' character.
372
375
  - In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'.
373
- - In case of ambiguity between `italic` and `underline` entities `__` is always greadily treated from left to right as beginning or end of an `underline` entity, so instead of `___italic underline___` use `___italic underline_**__`, adding an empty bold entity as a separator.
376
+ - In case of ambiguity between `italic` and `underline` entities `__` is always greedily treated from left to right as beginning or end of an `underline` entity, so instead of `___italic underline___` use `___italic underline_**__`, adding an empty bold entity as a separator.
374
377
  - A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
375
378
  - Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
376
379
 
@@ -424,12 +427,12 @@ Please note:
424
427
 
425
428
  - Entities must not be nested, use parse mode MarkdownV2 instead.
426
429
  - There is no way to specify “underline”, “strikethrough”, “spoiler”, “blockquote”, “expandable_blockquote” and “custom_emoji” entities, use parse mode MarkdownV2 instead.
427
- - To escape characters '_', '*', '`', '[' outside of an entity, prepend the characters '\' before them.
430
+ - To escape characters '_', '*', '`', '[' outside of an entity, prepend the character '\' before them.
428
431
  - Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */
429
432
  export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
430
433
  export declare namespace MessageEntity {
431
434
  interface AbstractMessageEntity {
432
- /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
435
+ /** Type of the entity. Currently, can be “mention” (`@username`), “hashtag” (#hashtag or `#hashtag@chatusername`), “cashtag” ($USD or `$USD@chatusername`), “bot_command” (`/start@jobs_bot`), “url” (https://telegram.org), “email” (`do-not-reply@telegram.org`), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
433
436
  type: string;
434
437
  /** Offset in UTF-16 code units to the start of the entity */
435
438
  offset: number;
@@ -530,7 +533,7 @@ export interface ExternalReplyInfo {
530
533
  export interface ReplyParameters {
531
534
  /** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified */
532
535
  message_id: number;
533
- /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats. */
536
+ /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format `@channelusername`). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats. */
534
537
  chat_id?: number | string;
535
538
  /** Identifier of the specific checklist task to be replied to */
536
539
  checklist_task_id?: number;
@@ -992,6 +995,8 @@ export interface ChatBackground {
992
995
  export interface ForumTopicCreated {
993
996
  /** Name of the topic */
994
997
  name: string;
998
+ /** True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */
999
+ is_name_implicit?: true;
995
1000
  /** Color of the topic icon in RGB format */
996
1001
  icon_color: number;
997
1002
  /** Unique identifier of the custom emoji shown as the topic icon */