@telegram.ts/types 1.25.1 → 1.26.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Bot API](https://img.shields.io/badge/Bot%20API-v.9.2-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
1
+ [![Bot API](https://img.shields.io/badge/Bot%20API-v.9.4-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
2
2
  [![NPM Version](https://img.shields.io/npm/v/@telegram.ts/types.svg?maxAge=3600)](https://www.npmjs.com/package/@telegram.ts/types)
3
3
  [![NPM Downloads](https://img.shields.io/npm/dt/@telegram.ts/types.svg?maxAge=3600)](https://www.npmjs.com/package/@telegram.ts/types)
4
4
 
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@telegram.ts/types",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "description": "Comprehensive Type Declarations for Telegram Bot API with telegramsjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
7
7
  "keywords": [
8
8
  "telegramsjs",
9
9
  "telegram",
10
+ "telegram.ts",
10
11
  "telegramapi",
11
12
  "api",
12
13
  "bot",
@@ -22,6 +22,7 @@ import type {
22
22
  UserFromGetMe,
23
23
  UserProfilePhotos,
24
24
  WebhookInfo,
25
+ UserProfileAudios,
25
26
  } from "./manageTypes";
26
27
  import type {
27
28
  ForceReply,
@@ -1025,6 +1026,16 @@ export type ApiMethods = {
1025
1026
  limit?: number;
1026
1027
  }): UserProfilePhotos;
1027
1028
 
1029
+ /** Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object. */
1030
+ getUserProfileAudios(args: {
1031
+ /** Unique identifier of the target user */
1032
+ user_id: number;
1033
+ /** Sequential number of the first audio to be returned. By default, all audios are returned. */
1034
+ offset?: number;
1035
+ /** Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100. */
1036
+ limit?: number;
1037
+ }): UserProfileAudios;
1038
+
1028
1039
  /** 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. */
1029
1040
  setUserEmojiStatus(args: {
1030
1041
  /** Unique identifier of the target user */
@@ -1365,7 +1376,8 @@ export type ApiMethods = {
1365
1376
 
1366
1377
  /** 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. */
1367
1378
  getForumTopicIconStickers(): Sticker[];
1368
- /** 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. */
1379
+
1380
+ /** 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. */
1369
1381
  createForumTopic(args: {
1370
1382
  /** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`) */
1371
1383
  chat_id: number | string;
@@ -1613,6 +1625,15 @@ export type ApiMethods = {
1613
1625
  language_code?: LanguageCode;
1614
1626
  }): BotShortDescription;
1615
1627
 
1628
+ /** Changes the profile photo of the bot. Returns True on success. */
1629
+ setMyProfilePhoto(args: {
1630
+ /** The new profile photo to set */
1631
+ photo: InputProfilePhoto;
1632
+ }): true;
1633
+
1634
+ /** Removes the profile photo of the bot. Requires no parameters. Returns True on success. */
1635
+ removeMyProfilePhoto(): true;
1636
+
1616
1637
  /** Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success. */
1617
1638
  setChatMenuButton(args: {
1618
1639
  /** Unique identifier for the target private chat. If not specified, default bot's menu button will be changed */
@@ -357,8 +357,10 @@ export interface UniqueGiftModel {
357
357
  name: string;
358
358
  /** The sticker that represents the unique gift */
359
359
  sticker: Sticker;
360
- /** The number of unique gifts that receive this model for every 1000 gifts upgraded */
360
+ /** The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts. */
361
361
  rarity_per_mille: number;
362
+ /** Rarity of the model if it is a crafted model. Currently, can be “uncommon”, “rare”, “epic”, or “legendary”. */
363
+ rarity?: "uncommon" | "rare" | "epic" | "legendary";
362
364
  }
363
365
 
364
366
  /** This object describes the symbol shown on the pattern of a unique gift. */
@@ -417,6 +419,8 @@ export interface UniqueGift {
417
419
  backdrop: UniqueGiftBackdrop;
418
420
  /** The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews */
419
421
  colors?: UniqueGiftColors;
422
+ /** True, if the gift was used to craft another gift and isn't available anymore */
423
+ is_burned?: true;
420
424
  }
421
425
 
422
426
  /** This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift. */
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ Audio,
2
3
  Location,
3
4
  Message,
4
5
  PhotoSize,
@@ -58,7 +59,7 @@ export interface User {
58
59
  /** User's or bot's username */
59
60
  username?: string;
60
61
  /** IETF language tag of the user's language */
61
- language_code?: LanguageCode;
62
+ language_code?: string;
62
63
  /** True, if this user is a Telegram Premium user */
63
64
  is_premium?: true;
64
65
  /** True, if this user added the bot to the attachment menu */
@@ -80,7 +81,21 @@ export interface UserFromGetMe extends User {
80
81
  /** True, if the bot has main Web App. Returned only in getMe. */
81
82
  has_main_web_app: boolean;
82
83
  /** True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */
83
- has_topics_enabled?: boolean;
84
+ has_topics_enabled: boolean;
85
+ /** True, if the bot allows users to create and delete topics in private chats. Returned only in getMe. */
86
+ allows_users_to_create_topics: boolean;
87
+ }
88
+
89
+ /** Describes a service message about the chat owner leaving the chat. */
90
+ export interface ChatOwnerLeft {
91
+ /** The user which will be the new owner of the chat if the previous owner does not return to the chat */
92
+ new_owner?: User;
93
+ }
94
+
95
+ /** Describes a service message about an ownership change in the chat. */
96
+ export interface ChatOwnerChanged {
97
+ /** The new owner of the chat */
98
+ new_owner: User;
84
99
  }
85
100
 
86
101
  /** This object describes the rating of a user based on their Telegram Star spendings. */
@@ -206,6 +221,8 @@ export declare namespace ChatFullInfo {
206
221
  max_reaction_count: number;
207
222
  /** Chat photo */
208
223
  photo?: ChatPhoto;
224
+ /** For private chats, the first audio added to the profile of the user */
225
+ first_profile_audio?: Audio;
209
226
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
210
227
  active_usernames?: string[];
211
228
  /** For private chats, the date of birth of the user */
@@ -307,6 +324,8 @@ export declare namespace ChatFullInfo {
307
324
  max_reaction_count: number;
308
325
  /** Chat photo */
309
326
  photo?: ChatPhoto;
327
+ /** For private chats, the first audio added to the profile of the user */
328
+ first_profile_audio?: undefined;
310
329
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
311
330
  active_usernames?: undefined;
312
331
  /** For private chats, the date of birth of the user */
@@ -408,6 +427,8 @@ export declare namespace ChatFullInfo {
408
427
  max_reaction_count: number;
409
428
  /** Chat photo */
410
429
  photo?: ChatPhoto;
430
+ /** For private chats, the first audio added to the profile of the user */
431
+ first_profile_audio?: undefined;
411
432
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
412
433
  active_usernames?: string[];
413
434
  /** For private chats, the date of birth of the user */
@@ -509,6 +530,8 @@ export declare namespace ChatFullInfo {
509
530
  max_reaction_count: number;
510
531
  /** Chat photo */
511
532
  photo?: ChatPhoto;
533
+ /** For private chats, the first audio added to the profile of the user */
534
+ first_profile_audio?: undefined;
512
535
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
513
536
  active_usernames?: string[];
514
537
  /** For private chats, the date of birth of the user */
@@ -605,6 +628,14 @@ export interface UserProfilePhotos {
605
628
  photos: PhotoSize[][];
606
629
  }
607
630
 
631
+ /** This object represents the audios displayed on a user's profile. */
632
+ export interface UserProfileAudios {
633
+ /** Total number of profile audios for the target user */
634
+ total_count: number;
635
+ /** Requested profile audios */
636
+ audios: Audio[];
637
+ }
638
+
608
639
  /** This object represents a chat photo. */
609
640
  export interface ChatPhoto {
610
641
  /** 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. */
@@ -8,9 +8,13 @@ export interface InlineKeyboardMarkup {
8
8
  }
9
9
 
10
10
  export declare namespace InlineKeyboardButton {
11
- interface AbstractInlineKeyboardButton {
11
+ export interface AbstractInlineKeyboardButton {
12
12
  /** Label text on the button */
13
13
  text: string;
14
+ /** 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. */
15
+ icon_custom_emoji_id?: string;
16
+ /** Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
17
+ style?: "danger" | "success" | "primary";
14
18
  }
15
19
  export interface UrlButton extends AbstractInlineKeyboardButton {
16
20
  /** 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 ID without using a username, if this is allowed by their privacy settings. */
@@ -60,7 +64,7 @@ export declare namespace InlineKeyboardButton {
60
64
  }
61
65
  }
62
66
 
63
- /** This object represents one button of an inline keyboard. You must use exactly one of the optional fields. */
67
+ /** 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. */
64
68
  export type InlineKeyboardButton =
65
69
  | InlineKeyboardButton.CallbackButton
66
70
  | InlineKeyboardButton.GameButton
@@ -145,8 +149,12 @@ export interface ReplyKeyboardMarkup {
145
149
 
146
150
  export declare namespace KeyboardButton {
147
151
  export interface CommonButton {
148
- /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
152
+ /** 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 */
149
153
  text: string;
154
+ /** 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. */
155
+ icon_custom_emoji_id?: string;
156
+ /** Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
157
+ style?: "danger" | "success" | "primary";
150
158
  }
151
159
  export interface RequestUsersButton extends CommonButton {
152
160
  /** 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. */
@@ -174,7 +182,7 @@ export declare namespace KeyboardButton {
174
182
  }
175
183
  }
176
184
 
177
- /** 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. */
185
+ /** 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. */
178
186
  export type KeyboardButton =
179
187
  | KeyboardButton.CommonButton
180
188
  | KeyboardButton.RequestUsersButton
@@ -1,4 +1,3 @@
1
- import type { Chat, User } from "./manageTypes";
2
1
  import type { InlineKeyboardMarkup } from "./markupTypes";
3
2
  import type { PassportData } from "./passportTypes";
4
3
  import type { LanguageCode } from "./languageTypes";
@@ -7,6 +6,12 @@ import type {
7
6
  ChecklistTasksAdded,
8
7
  ChecklistTasksDone,
9
8
  } from "./checkListTask";
9
+ import type {
10
+ Chat,
11
+ ChatOwnerChanged,
12
+ ChatOwnerLeft,
13
+ User,
14
+ } from "./manageTypes";
10
15
  import type {
11
16
  GiftInfo,
12
17
  Invoice,
@@ -139,6 +144,10 @@ export declare namespace Message {
139
144
  MsgWith<"suggested_post_paid">;
140
145
  export type SuggestedPostRefundedMessage = ServiceMessage &
141
146
  MsgWith<"suggested_post_refunded">;
147
+ export type ChatOwnerLeftMessage = ServiceMessage &
148
+ MsgWith<"chat_owner_left">;
149
+ export type ChatOwnerChangedMessage = ServiceMessage &
150
+ MsgWith<"chat_owner_changed">;
142
151
  export type NewChatMembersMessage = ServiceMessage &
143
152
  MsgWith<"new_chat_members">;
144
153
  export type LeftChatMemberMessage = ServiceMessage &
@@ -270,6 +279,10 @@ export interface Message extends Message.MediaMessage {
270
279
  suggested_post_paid?: SuggestedPostPaid;
271
280
  /** Service message: payment for a suggested post was refunded */
272
281
  suggested_post_refunded?: SuggestedPostRefunded;
282
+ /** Service message: chat owner has left */
283
+ chat_owner_left?: ChatOwnerLeft;
284
+ /** Service message: chat owner has changed */
285
+ chat_owner_changed?: ChatOwnerChanged;
273
286
  /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
274
287
  new_chat_members?: User[];
275
288
  /** A member was removed from the group, information about them (this member may be the bot itself) */
@@ -804,6 +817,24 @@ export interface Video {
804
817
  mime_type?: string;
805
818
  /** File size in bytes */
806
819
  file_size?: number;
820
+ /** List of available qualities of the video. */
821
+ qualities?: VideoQuality[];
822
+ }
823
+
824
+ /** This object represents a video file of a specific quality. */
825
+ export interface VideoQuality {
826
+ /** Identifier for this file, which can be used to download or reuse the file */
827
+ file_id: string;
828
+ /** 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. */
829
+ file_unique_id: string;
830
+ /** Video width */
831
+ width: number;
832
+ /** Video height */
833
+ height: number;
834
+ /** Codec that was used to encode the video, for example, “h264”, “h265”, or “av01” */
835
+ codec: string;
836
+ /** 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. */
837
+ file_size?: number;
807
838
  }
808
839
 
809
840
  /** This object represents a video message (available in Telegram apps as of v.4.0). */