@grammyjs/types 3.23.0 → 3.24.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
@@ -35,7 +35,7 @@ export interface InputChecklistTask {
35
35
  /** Text of the task; 1-100 characters after entities parsing */
36
36
  text: string;
37
37
  /** Mode for parsing entities in the text. See formatting options for more details. */
38
- parse_mode?: string;
38
+ parse_mode?: ParseMode;
39
39
  /** List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. */
40
40
  text_entities?: MessageEntity[];
41
41
  }
package/manage.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Location, Message, PhotoSize, ReactionType, Sticker } from "./message.js";
1
+ import type { Audio, Location, Message, PhotoSize, ReactionType, Sticker } from "./message.js";
2
2
  import type { UniqueGiftColors } from "./payment.js";
3
3
  import type { Update } from "./update.js";
4
4
  /** Describes the current status of a webhook. */
@@ -69,7 +69,19 @@ export interface UserFromGetMe extends User {
69
69
  /** True, if the bot has main Web App. Returned only in getMe. */
70
70
  has_main_web_app: boolean;
71
71
  /** True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */
72
- has_topics_enabled?: boolean;
72
+ has_topics_enabled: boolean;
73
+ /** True, if the bot allows users to create and delete topics in private chats. Returned only in getMe. */
74
+ allows_users_to_create_topics: boolean;
75
+ }
76
+ /** Describes a service message about the chat owner leaving the chat. */
77
+ export interface ChatOwnerLeft {
78
+ /** The user which will be the new owner of the chat if the previous owner does not return to the chat */
79
+ new_owner?: User;
80
+ }
81
+ /** Describes a service message about an ownership change in the chat. */
82
+ export interface ChatOwnerChanged {
83
+ /** The new owner of the chat */
84
+ new_owner: User;
73
85
  }
74
86
  /** This object describes the rating of a user based on their Telegram Star spendings. */
75
87
  export interface UserRating {
@@ -187,6 +199,8 @@ export declare namespace ChatFullInfo {
187
199
  max_reaction_count: number;
188
200
  /** Chat photo */
189
201
  photo?: ChatPhoto;
202
+ /** For private chats, the first audio added to the profile of the user */
203
+ first_profile_audio?: Audio;
190
204
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
191
205
  active_usernames?: string[];
192
206
  /** For private chats, the date of birth of the user */
@@ -288,6 +302,8 @@ export declare namespace ChatFullInfo {
288
302
  max_reaction_count: number;
289
303
  /** Chat photo */
290
304
  photo?: ChatPhoto;
305
+ /** For private chats, the first audio added to the profile of the user */
306
+ first_profile_audio?: undefined;
291
307
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
292
308
  active_usernames?: undefined;
293
309
  /** For private chats, the date of birth of the user */
@@ -389,6 +405,8 @@ export declare namespace ChatFullInfo {
389
405
  max_reaction_count: number;
390
406
  /** Chat photo */
391
407
  photo?: ChatPhoto;
408
+ /** For private chats, the first audio added to the profile of the user */
409
+ first_profile_audio?: undefined;
392
410
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
393
411
  active_usernames?: string[];
394
412
  /** For private chats, the date of birth of the user */
@@ -490,6 +508,8 @@ export declare namespace ChatFullInfo {
490
508
  max_reaction_count: number;
491
509
  /** Chat photo */
492
510
  photo?: ChatPhoto;
511
+ /** For private chats, the first audio added to the profile of the user */
512
+ first_profile_audio?: undefined;
493
513
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
494
514
  active_usernames?: string[];
495
515
  /** For private chats, the date of birth of the user */
@@ -579,6 +599,13 @@ export interface UserProfilePhotos {
579
599
  /** Requested profile pictures (in up to 4 sizes each) */
580
600
  photos: PhotoSize[][];
581
601
  }
602
+ /** This object represents the audios displayed on a user's profile. */
603
+ export interface UserProfileAudios {
604
+ /** Total number of profile audios for the target user */
605
+ total_count: number;
606
+ /** Requested profile audios */
607
+ audios: Audio[];
608
+ }
582
609
  /** This object represents a chat photo. */
583
610
  export interface ChatPhoto {
584
611
  /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
package/markup.d.ts CHANGED
@@ -9,6 +9,10 @@ export declare namespace InlineKeyboardButton {
9
9
  interface AbstractInlineKeyboardButton {
10
10
  /** Label text on the button */
11
11
  text: string;
12
+ /** Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
13
+ icon_custom_emoji_id?: string;
14
+ /** Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
15
+ style?: "danger" | "success" | "primary";
12
16
  }
13
17
  interface UrlButton extends AbstractInlineKeyboardButton {
14
18
  /** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. */
@@ -57,7 +61,7 @@ export declare namespace InlineKeyboardButton {
57
61
  pay: boolean;
58
62
  }
59
63
  }
60
- /** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
64
+ /** This object represents one button of an inline keyboard. Exactly one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. */
61
65
  export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.CopyTextButtonButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton;
62
66
  /** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
63
67
  Telegram apps support these buttons as of version 5.7. */
@@ -127,8 +131,12 @@ export interface ReplyKeyboardMarkup {
127
131
  }
128
132
  export declare namespace KeyboardButton {
129
133
  interface CommonButton {
130
- /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
134
+ /** Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used, it will be sent as a message when the button is pressed */
131
135
  text: string;
136
+ /** Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
137
+ icon_custom_emoji_id?: string;
138
+ /** Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
139
+ style?: "danger" | "success" | "primary";
132
140
  }
133
141
  interface RequestUsersButton extends CommonButton {
134
142
  /** 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. */
@@ -155,7 +163,7 @@ export declare namespace KeyboardButton {
155
163
  web_app: WebAppInfo;
156
164
  }
157
165
  }
158
- /** This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. */
166
+ /** This object represents one button of the reply keyboard. At most one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text. */
159
167
  export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUsersButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string;
160
168
  /** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
161
169
  export interface KeyboardButtonPollType {
package/message.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Checklist, ChecklistTasksAdded, ChecklistTasksDone } from "./checklist.js";
2
- import type { Chat, User } from "./manage.js";
2
+ import type { Chat, ChatOwnerChanged, ChatOwnerLeft, User } from "./manage.js";
3
3
  import type { InlineKeyboardMarkup } from "./markup.js";
4
4
  import type { PassportData } from "./passport.js";
5
5
  import type { GiftInfo, Invoice, PaidMessagePriceChanged, RefundedPayment, SuccessfulPayment, SuggestedPostApprovalFailed, SuggestedPostApproved, SuggestedPostDeclined, SuggestedPostInfo, SuggestedPostPaid, SuggestedPostPrice, SuggestedPostRefunded, UniqueGiftInfo } from "./payment.js";
@@ -106,6 +106,8 @@ export declare namespace Message {
106
106
  type SuggestedPostDeclinedMessage = ServiceMessage & MsgWith<"suggested_post_declined">;
107
107
  type SuggestedPostPaidMessage = ServiceMessage & MsgWith<"suggested_post_paid">;
108
108
  type SuggestedPostRefundedMessage = ServiceMessage & MsgWith<"suggested_post_refunded">;
109
+ type ChatOwnerLeftMessage = ServiceMessage & MsgWith<"chat_owner_left">;
110
+ type ChatOwnerChangedMessage = ServiceMessage & MsgWith<"chat_owner_changed">;
109
111
  type NewChatMembersMessage = ServiceMessage & MsgWith<"new_chat_members">;
110
112
  type LeftChatMemberMessage = ServiceMessage & MsgWith<"left_chat_member">;
111
113
  type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
@@ -208,6 +210,10 @@ export interface Message extends Message.MediaMessage {
208
210
  suggested_post_paid?: SuggestedPostPaid;
209
211
  /** Service message: payment for a suggested post was refunded */
210
212
  suggested_post_refunded?: SuggestedPostRefunded;
213
+ /** Service message: chat owner has left */
214
+ chat_owner_left?: ChatOwnerLeft;
215
+ /** Service message: chat owner has changed */
216
+ chat_owner_changed?: ChatOwnerChanged;
211
217
  /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
212
218
  new_chat_members?: User[];
213
219
  /** A member was removed from the group, information about them (this member may be the bot itself) */
@@ -698,6 +704,23 @@ export interface Video {
698
704
  mime_type?: string;
699
705
  /** File size in bytes */
700
706
  file_size?: number;
707
+ /** List of available qualities of the video. */
708
+ qualities?: VideoQuality[];
709
+ }
710
+ /** This object represents a video file of a specific quality. */
711
+ export interface VideoQuality {
712
+ /** Identifier for this file, which can be used to download or reuse the file */
713
+ file_id: string;
714
+ /** 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. */
715
+ file_unique_id: string;
716
+ /** Video width */
717
+ width: number;
718
+ /** Video height */
719
+ height: number;
720
+ /** Codec that was used to encode the video, for example, “h264”, “h265”, or “av01” */
721
+ codec: string;
722
+ /** File size in bytes. It can be bigger than 2^31 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 value. */
723
+ file_size?: number;
701
724
  }
702
725
  /** This object represents a video message (available in Telegram apps as of v.4.0). */
703
726
  export interface VideoNote {
package/methods.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { InputChecklist } from "./checklist.js";
2
2
  import type { InlineQueryResult, InlineQueryResultsButton } from "./inline.js";
3
3
  import type { LanguageCode } from "./langs.js";
4
- import type { AcceptedGiftTypes, BotCommand, BusinessConnection, ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js";
4
+ import type { AcceptedGiftTypes, BotCommand, BusinessConnection, ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfileAudios, UserProfilePhotos, WebhookInfo } from "./manage.js";
5
5
  import type { ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "./markup.js";
6
6
  import type { File, GameHighScore, InputPollOption, LinkPreviewOptions, MaskPosition, Message, MessageEntity, MessageId, ParseMode, Poll, PreparedInlineMessage, ReactionType, ReplyParameters, SentWebAppMessage, Sticker, StickerSet, Story, SuggestedPostParameters } from "./message.js";
7
7
  import type { PassportElementError } from "./passport.js";
@@ -883,6 +883,15 @@ export type ApiMethods<F> = {
883
883
  /** Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
884
884
  limit?: number;
885
885
  }): UserProfilePhotos;
886
+ /** Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object. */
887
+ getUserProfileAudios(args: {
888
+ /** Unique identifier of the target user */
889
+ user_id: number;
890
+ /** Sequential number of the first audio to be returned. By default, all audios are returned. */
891
+ offset?: number;
892
+ /** Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
893
+ limit?: number;
894
+ }): UserProfileAudios;
886
895
  /** Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success. */
887
896
  setUserEmojiStatus(args: {
888
897
  /** Unique identifier of the target user */
@@ -1195,7 +1204,7 @@ export type ApiMethods<F> = {
1195
1204
  }): true;
1196
1205
  /** Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects. */
1197
1206
  getForumTopicIconStickers(): Sticker[];
1198
- /** Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object. */
1207
+ /** Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object. */
1199
1208
  createForumTopic(args: {
1200
1209
  /** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`) */
1201
1210
  chat_id: number | string;
@@ -1411,6 +1420,13 @@ export type ApiMethods<F> = {
1411
1420
  /** A two-letter ISO 639-1 language code or an empty string */
1412
1421
  language_code?: LanguageCode;
1413
1422
  }): BotShortDescription;
1423
+ /** Changes the profile photo of the bot. Returns True on success. */
1424
+ setMyProfilePhoto(args: {
1425
+ /** The new profile photo to set */
1426
+ photo: InputProfilePhoto<F>;
1427
+ }): true;
1428
+ /** Removes the profile photo of the bot. Requires no parameters. Returns True on success. */
1429
+ removeMyProfilePhoto(): true;
1414
1430
  /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. */
1415
1431
  setChatMenuButton(args: {
1416
1432
  /** Unique identifier for the target private chat. If not specified, default bot's menu button will be changed */
@@ -1889,7 +1905,7 @@ export type ApiMethods<F> = {
1889
1905
  text_parse_mode?: ParseMode;
1890
1906
  /** A list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1891
1907
  text_entities?: MessageEntity[];
1892
- }): Gifts;
1908
+ }): true;
1893
1909
  /** Gifts a Telegram Premium subscription to the given user. Returns True on success. */
1894
1910
  giftPremiumSubscription(args: {
1895
1911
  /** Unique identifier of the target user who will receive a Telegram Premium subscription */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.23.0",
3
+ "version": "3.24.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "mod.js",
6
6
  "repository": {
package/payment.d.ts CHANGED
@@ -308,8 +308,10 @@ export interface UniqueGiftModel {
308
308
  name: string;
309
309
  /** The sticker that represents the unique gift */
310
310
  sticker: Sticker;
311
- /** The number of unique gifts that receive this model for every 1000 gifts upgraded */
311
+ /** The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts. */
312
312
  rarity_per_mille: number;
313
+ /** Rarity of the model if it is a crafted model. Currently, can be “uncommon”, “rare”, “epic”, or “legendary”. */
314
+ rarity?: "uncommon" | "rare" | "epic" | "legendary";
313
315
  }
314
316
  /** This object describes the symbol shown on the pattern of a unique gift. */
315
317
  export interface UniqueGiftSymbol {
@@ -364,6 +366,8 @@ export interface UniqueGift {
364
366
  backdrop: UniqueGiftBackdrop;
365
367
  /** The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews */
366
368
  colors?: UniqueGiftColors;
369
+ /** True, if the gift was used to craft another gift and isn't available anymore */
370
+ is_burned?: true;
367
371
  }
368
372
  /** This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift. */
369
373
  export interface UniqueGiftColors {