@telegram.ts/types 1.4.0 → 1.6.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.
@@ -1,5 +1,11 @@
1
- import type { Location, Message, PhotoSize } from "./messageTypes.js";
2
- import type { Update } from "./updateTypes.js";
1
+ import type {
2
+ Location,
3
+ Message,
4
+ PhotoSize,
5
+ ReactionType,
6
+ } from "./messageTypes";
7
+ import type { Update } from "./updateTypes";
8
+
3
9
  /** Describes the current status of a webhook. */
4
10
  export interface WebhookInfo {
5
11
  /** Webhook URL, may be empty if webhook is not set up */
@@ -21,9 +27,10 @@ export interface WebhookInfo {
21
27
  /** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
22
28
  allowed_updates?: Array<Exclude<keyof Update, "update_id">>;
23
29
  }
30
+
24
31
  /** This object represents a Telegram user or bot. */
25
32
  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. */
33
+ /** Unique identifier for this user or bot. */
27
34
  id: number;
28
35
  /** True, if this user is a bot */
29
36
  is_bot: boolean;
@@ -40,6 +47,7 @@ export interface User {
40
47
  /** True, if this user added the bot to the attachment menu */
41
48
  added_to_attachment_menu?: true;
42
49
  }
50
+
43
51
  /** This object represents a Telegram user or bot that was returned by `getMe`. */
44
52
  export interface UserFromGetMe extends User {
45
53
  is_bot: true;
@@ -51,14 +59,18 @@ export interface UserFromGetMe extends User {
51
59
  /** True, if the bot supports inline queries. Returned only in getMe. */
52
60
  supports_inline_queries: boolean;
53
61
  }
62
+
54
63
  export declare namespace Chat {
64
+ // ABSTRACT
55
65
  /** Internal type holding properties that all kinds of chats share. */
56
66
  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. */
67
+ /** Unique identifier for this chat. */
58
68
  id: number;
59
69
  /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
60
70
  type: string;
61
71
  }
72
+
73
+ // HELPERS
62
74
  /** Internal type holding properties that those chats with user names share. */
63
75
  interface UserNameChat {
64
76
  /** Username, for private chats, supergroups and channels if available */
@@ -69,6 +81,8 @@ export declare namespace Chat {
69
81
  /** Title, for supergroups, channels and group chats */
70
82
  title: string;
71
83
  }
84
+
85
+ // ==> CHATS
72
86
  /** Internal type representing private chats. */
73
87
  export interface PrivateChat extends AbstractChat, UserNameChat {
74
88
  type: "private";
@@ -94,6 +108,8 @@ export declare namespace Chat {
94
108
  export interface ChannelChat extends AbstractChat, UserNameChat, TitleChat {
95
109
  type: "channel";
96
110
  }
111
+
112
+ // GET CHAT HELPERS
97
113
  /** Internal type holding properties that those chats returned from `getChat` share. */
98
114
  interface GetChat {
99
115
  /** Chat photo. Returned only in getChat. */
@@ -106,38 +122,48 @@ export declare namespace Chat {
106
122
  has_protected_content?: true;
107
123
  }
108
124
  /** Internal type holding properties that those private, supergroup, and channel chats returned from `getChat` share. */
109
- interface NonGroupGetChat extends GetChat {
125
+ interface NonGroupGetChat {
110
126
  /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */
111
127
  active_usernames?: string[];
112
128
  }
113
129
  /** Internal type holding properties that those group, supergroup, and channel chats returned from `getChat` share. */
114
- interface NonPrivateGetChat extends GetChat {
130
+ interface NonPrivateGetChat {
115
131
  /** Description, for groups, supergroups and channel chats. Returned only in getChat. */
116
132
  description?: string;
117
133
  /** Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */
118
134
  invite_link?: string;
135
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat. */
136
+ available_reactions?: ReactionType[];
119
137
  }
120
138
  /** Internal type holding properties that those group and supergroup chats returned from `getChat` share. */
121
- interface MultiUserGetChat extends NonPrivateGetChat {
139
+ interface MultiUserGetChat {
122
140
  /** Default chat member permissions, for groups and supergroups. Returned only in getChat. */
123
141
  permissions?: ChatPermissions;
124
- /** True, if the bot can change the group sticker set. Returned only in getChat. */
125
- can_set_sticker_set?: true;
142
+ }
143
+ /** Internal type holding properties that those private and channel chats returned from `getChat` share. */
144
+ interface NonMultiUserGetChat {
145
+ /** 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. */
146
+ accent_color_id: number;
147
+ /** Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat. */
148
+ background_custom_emoji_id?: string;
149
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in getChat. */
150
+ emoji_status_custom_emoji_id?: string;
151
+ /** 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. */
152
+ emoji_status_expiration_date?: number;
126
153
  }
127
154
  /** Internal type holding properties that those supergroup and channel chats returned from `getChat` share. */
128
- interface LargeGetChat extends NonPrivateGetChat {
129
- /** 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. */
155
+ interface LargeGetChat {
156
+ /** 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. */
130
157
  linked_chat_id?: number;
131
158
  }
159
+
160
+ // ==> GET CHATS
132
161
  /** Internal type representing private chats returned from `getChat`. */
133
162
  export interface PrivateGetChat
134
163
  extends PrivateChat,
164
+ GetChat,
135
165
  NonGroupGetChat,
136
- GetChat {
137
- /** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
138
- emoji_status_custom_emoji_id?: string;
139
- /** Expiration date of the emoji status of the other party in a private chat, if any. Returned only in getChat. */
140
- emoji_status_expiration_date?: number;
166
+ NonMultiUserGetChat {
141
167
  /** Bio of the other party in a private chat. Returned only in getChat. */
142
168
  bio?: string;
143
169
  /** 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. */
@@ -146,11 +172,17 @@ export declare namespace Chat {
146
172
  has_restricted_voice_and_video_messages?: true;
147
173
  }
148
174
  /** Internal type representing group chats returned from `getChat`. */
149
- export interface GroupGetChat extends GroupChat, MultiUserGetChat {}
175
+ export interface GroupGetChat
176
+ extends GroupChat,
177
+ GetChat,
178
+ NonPrivateGetChat,
179
+ MultiUserGetChat {}
150
180
  /** Internal type representing supergroup chats returned from `getChat`. */
151
181
  export interface SupergroupGetChat
152
182
  extends SupergroupChat,
183
+ GetChat,
153
184
  NonGroupGetChat,
185
+ NonPrivateGetChat,
154
186
  MultiUserGetChat,
155
187
  LargeGetChat {
156
188
  /** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
@@ -159,32 +191,50 @@ export declare namespace Chat {
159
191
  join_by_request?: true;
160
192
  /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
161
193
  slow_mode_delay?: number;
194
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat. */
195
+ unrestrict_boost_count?: number;
196
+ /** True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat. */
197
+ has_visible_history?: boolean;
162
198
  /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */
163
199
  has_aggressive_anti_spam_enabled?: true;
164
200
  /** For supergroups, name of group sticker set. Returned only in getChat. */
165
201
  sticker_set_name?: string;
202
+ /** True, if the bot can change the group sticker set. Returned only in getChat. */
203
+ can_set_sticker_set?: true;
204
+ /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat. */
205
+ custom_emoji_sticker_set_name?: string;
166
206
  /** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
167
207
  location?: ChatLocation;
168
208
  }
169
209
  /** Internal type representing channel chats returned from `getChat`. */
170
210
  export interface ChannelGetChat
171
211
  extends ChannelChat,
212
+ GetChat,
172
213
  NonGroupGetChat,
173
- LargeGetChat {}
174
- export {};
214
+ NonPrivateGetChat,
215
+ NonMultiUserGetChat,
216
+ LargeGetChat {
217
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat. */
218
+ profile_accent_color_id?: number;
219
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat. */
220
+ profile_background_custom_emoji_id?: string;
221
+ }
175
222
  }
223
+
176
224
  /** This object represents a chat. */
177
225
  export type Chat =
178
226
  | Chat.PrivateChat
179
227
  | Chat.GroupChat
180
228
  | Chat.SupergroupChat
181
229
  | Chat.ChannelChat;
230
+
182
231
  /** This object represents a Telegram user or bot that was returned by `getChat`. */
183
232
  export type ChatFromGetChat =
184
233
  | Chat.PrivateGetChat
185
234
  | Chat.GroupGetChat
186
235
  | Chat.SupergroupGetChat
187
236
  | Chat.ChannelGetChat;
237
+
188
238
  /** This object represent a user's profile pictures. */
189
239
  export interface UserProfilePhotos {
190
240
  /** Total number of profile pictures the target user has */
@@ -192,6 +242,7 @@ export interface UserProfilePhotos {
192
242
  /** Requested profile pictures (in up to 4 sizes each) */
193
243
  photos: PhotoSize[][];
194
244
  }
245
+
195
246
  /** This object represents a chat photo. */
196
247
  export interface ChatPhoto {
197
248
  /** 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. */
@@ -203,6 +254,7 @@ export interface ChatPhoto {
203
254
  /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
204
255
  big_file_unique_id: string;
205
256
  }
257
+
206
258
  /** Represents an invite link for a chat. */
207
259
  export interface ChatInviteLink {
208
260
  /** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with "...". */
@@ -224,17 +276,18 @@ export interface ChatInviteLink {
224
276
  /** Number of pending join requests created using this link */
225
277
  pending_join_request_count?: number;
226
278
  }
279
+
227
280
  /** Represents the rights of an administrator in a chat. */
228
281
  export interface ChatAdministratorRights {
229
282
  /** True, if the user's presence in the chat is hidden */
230
283
  is_anonymous: boolean;
231
- /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
284
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
232
285
  can_manage_chat: boolean;
233
286
  /** True, if the administrator can delete messages of other users */
234
287
  can_delete_messages: boolean;
235
288
  /** True, if the administrator can manage video chats */
236
289
  can_manage_video_chats: boolean;
237
- /** True, if the administrator can restrict, ban or unban chat members */
290
+ /** True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics */
238
291
  can_restrict_members: boolean;
239
292
  /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
240
293
  can_promote_members: boolean;
@@ -242,21 +295,40 @@ export interface ChatAdministratorRights {
242
295
  can_change_info: boolean;
243
296
  /** True, if the user is allowed to invite new users to the chat */
244
297
  can_invite_users: boolean;
245
- /** True, if the administrator can post in the channel; channels only */
298
+ /** True, if the administrator can post messages in the channel, or access channel statistics; channels only */
246
299
  can_post_messages?: boolean;
247
300
  /** True, if the administrator can edit messages of other users and can pin messages; channels only */
248
301
  can_edit_messages?: boolean;
249
302
  /** True, if the user is allowed to pin messages; groups and supergroups only */
250
303
  can_pin_messages?: boolean;
251
- /** True, if the administrator can post stories in the channel; channels only */
304
+ /** True, if the administrator can post stories to the chat */
252
305
  can_post_stories?: boolean;
253
- /** True, if the administrator can edit stories posted by other users; channels only */
306
+ /** True, if the administrator can edit stories posted by other users */
254
307
  can_edit_stories?: boolean;
255
308
  /** True, if the administrator can delete stories posted by other users; channels only */
256
309
  can_delete_stories?: boolean;
257
310
  /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
258
311
  can_manage_topics?: boolean;
259
312
  }
313
+
314
+ /** This object represents changes in the status of a chat member. */
315
+ export interface ChatMemberUpdated {
316
+ /** Chat the user belongs to */
317
+ chat: Chat;
318
+ /** Performer of the action, which resulted in the change */
319
+ from: User;
320
+ /** Date the change was done in Unix time */
321
+ date: number;
322
+ /** Previous information about the chat member */
323
+ old_chat_member: ChatMember;
324
+ /** New information about the chat member */
325
+ new_chat_member: ChatMember;
326
+ /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
327
+ invite_link?: ChatInviteLink;
328
+ /** True, if the user joined the chat via a chat folder invite link */
329
+ via_chat_folder_invite_link?: boolean;
330
+ }
331
+
260
332
  /** This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
261
333
  - ChatMemberOwner
262
334
  - ChatMemberAdministrator
@@ -271,6 +343,7 @@ export type ChatMember =
271
343
  | ChatMemberRestricted
272
344
  | ChatMemberLeft
273
345
  | ChatMemberBanned;
346
+
274
347
  /** Represents a chat member that owns the chat and has all administrator privileges. */
275
348
  export interface ChatMemberOwner {
276
349
  /** The member's status in the chat, always “creator” */
@@ -282,6 +355,7 @@ export interface ChatMemberOwner {
282
355
  /** Custom title for this user */
283
356
  custom_title?: string;
284
357
  }
358
+
285
359
  /** Represents a chat member that has some additional privileges. */
286
360
  export interface ChatMemberAdministrator {
287
361
  /** The member's status in the chat, always “administrator” */
@@ -292,13 +366,13 @@ export interface ChatMemberAdministrator {
292
366
  can_be_edited: boolean;
293
367
  /** True, if the user's presence in the chat is hidden */
294
368
  is_anonymous: boolean;
295
- /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
369
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
296
370
  can_manage_chat: boolean;
297
371
  /** True, if the administrator can delete messages of other users */
298
372
  can_delete_messages: boolean;
299
373
  /** True, if the administrator can manage video chats */
300
374
  can_manage_video_chats: boolean;
301
- /** True, if the administrator can restrict, ban or unban chat members */
375
+ /** True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics */
302
376
  can_restrict_members: boolean;
303
377
  /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
304
378
  can_promote_members: boolean;
@@ -306,23 +380,24 @@ export interface ChatMemberAdministrator {
306
380
  can_change_info: boolean;
307
381
  /** True, if the user is allowed to invite new users to the chat */
308
382
  can_invite_users: boolean;
309
- /** True, if the administrator can post in the channel; channels only */
383
+ /** True, if the administrator can post messages in the channel, or access channel statistics; channels only */
310
384
  can_post_messages?: boolean;
311
385
  /** True, if the administrator can edit messages of other users and can pin messages; channels only */
312
386
  can_edit_messages?: boolean;
313
387
  /** True, if the user is allowed to pin messages; groups and supergroups only */
314
388
  can_pin_messages?: boolean;
315
- /** True, if the administrator can post stories in the channel; channels only */
389
+ /** True, if the administrator can post stories to the chat */
316
390
  can_post_stories?: boolean;
317
- /** True, if the administrator can edit stories posted by other users; channels only */
391
+ /** True, if the administrator can edit stories posted by other users */
318
392
  can_edit_stories?: boolean;
319
- /** True, if the administrator can delete stories posted by other users; channels only */
393
+ /** True, if the administrator can delete stories posted by other users */
320
394
  can_delete_stories?: boolean;
321
395
  /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
322
396
  can_manage_topics?: boolean;
323
397
  /** Custom title for this user */
324
398
  custom_title?: string;
325
399
  }
400
+
326
401
  /** Represents a chat member that has no additional privileges or restrictions. */
327
402
  export interface ChatMemberMember {
328
403
  /** The member's status in the chat, always “member” */
@@ -330,6 +405,7 @@ export interface ChatMemberMember {
330
405
  /** Information about the user */
331
406
  user: User;
332
407
  }
408
+
333
409
  /** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
334
410
  export interface ChatMemberRestricted {
335
411
  /** The member's status in the chat, always “restricted” */
@@ -338,7 +414,7 @@ export interface ChatMemberRestricted {
338
414
  user: User;
339
415
  /** True, if the user is a member of the chat at the moment of the request */
340
416
  is_member: boolean;
341
- /** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
417
+ /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
342
418
  can_send_messages: boolean;
343
419
  /** True, if the user is allowed to send audios */
344
420
  can_send_audios: boolean;
@@ -366,9 +442,10 @@ export interface ChatMemberRestricted {
366
442
  can_pin_messages: boolean;
367
443
  /** True, if the user is allowed to create forum topics */
368
444
  can_manage_topics: boolean;
369
- /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever */
445
+ /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever */
370
446
  until_date: number;
371
447
  }
448
+
372
449
  /** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */
373
450
  export interface ChatMemberLeft {
374
451
  /** The member's status in the chat, always “left” */
@@ -376,39 +453,24 @@ export interface ChatMemberLeft {
376
453
  /** Information about the user */
377
454
  user: User;
378
455
  }
456
+
379
457
  /** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */
380
458
  export interface ChatMemberBanned {
381
459
  /** The member's status in the chat, always “kicked” */
382
460
  status: "kicked";
383
461
  /** Information about the user */
384
462
  user: User;
385
- /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever */
463
+ /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever */
386
464
  until_date: number;
387
465
  }
388
- /** This object represents changes in the status of a chat member. */
389
- export interface ChatMemberUpdated {
390
- /** Chat the user belongs to */
391
- chat: Chat;
392
- /** Performer of the action, which resulted in the change */
393
- from: User;
394
- /** Date the change was done in Unix time */
395
- date: number;
396
- /** Previous information about the chat member */
397
- old_chat_member: ChatMember;
398
- /** New information about the chat member */
399
- new_chat_member: ChatMember;
400
- /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
401
- invite_link?: ChatInviteLink;
402
- /** True, if the user joined the chat via a chat folder invite link */
403
- via_chat_folder_invite_link?: boolean;
404
- }
466
+
405
467
  /** Represents a join request sent to a chat. */
406
468
  export interface ChatJoinRequest {
407
469
  /** Chat to which the request was sent */
408
470
  chat: Chat.SupergroupChat | Chat.ChannelChat;
409
471
  /** User that sent the join request */
410
472
  from: User;
411
- /** 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 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. */
473
+ /** 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. */
412
474
  user_chat_id: number;
413
475
  /** Date the request was sent in Unix time */
414
476
  date: number;
@@ -417,9 +479,10 @@ export interface ChatJoinRequest {
417
479
  /** Chat invite link that was used by the user to send the join request */
418
480
  invite_link?: ChatInviteLink;
419
481
  }
482
+
420
483
  /** Describes actions that a non-administrator user is allowed to take in a chat. */
421
484
  export interface ChatPermissions {
422
- /** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
485
+ /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
423
486
  can_send_messages?: boolean;
424
487
  /** True, if the user is allowed to send audios */
425
488
  can_send_audios?: boolean;
@@ -448,6 +511,7 @@ export interface ChatPermissions {
448
511
  /** True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages */
449
512
  can_manage_topics?: boolean;
450
513
  }
514
+
451
515
  /** Represents a location to which a chat is connected. */
452
516
  export interface ChatLocation {
453
517
  /** The location to which the supergroup is connected. Can't be a live location. */
@@ -455,6 +519,7 @@ export interface ChatLocation {
455
519
  /** Location address; 1-64 characters, as defined by the chat owner */
456
520
  address: string;
457
521
  }
522
+
458
523
  /** This object represents a forum topic. */
459
524
  export interface ForumTopic {
460
525
  /** Unique identifier of the forum topic */
@@ -466,6 +531,7 @@ export interface ForumTopic {
466
531
  /** Unique identifier of the custom emoji shown as the topic icon */
467
532
  icon_custom_emoji_id?: string;
468
533
  }
534
+
469
535
  /** This object represents a bot command. */
470
536
  export interface BotCommand {
471
537
  /** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */
@@ -473,14 +539,75 @@ export interface BotCommand {
473
539
  /** Description of the command; 1-256 characters. */
474
540
  description: string;
475
541
  }
476
- /** 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. */
477
- export interface File {
478
- /** Identifier for this file, which can be used to download or reuse the file */
479
- file_id: string;
480
- /** 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. */
481
- file_unique_id: string;
482
- /** File size in bytes */
483
- file_size?: number;
484
- /** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
485
- file_path?: string;
542
+
543
+ /** This object describes the source of a chat boost. It can be one of
544
+
545
+ - ChatBoostSourcePremium
546
+ - ChatBoostSourceGiftCode
547
+ - ChatBoostSourceGiveaway */
548
+ export type ChatBoostSource =
549
+ | ChatBoostSourcePremium
550
+ | ChatBoostSourceGiftCode
551
+ | ChatBoostSourceGiveaway;
552
+
553
+ /** The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. */
554
+ export interface ChatBoostSourcePremium {
555
+ /** Source of the boost, always “premium” */
556
+ source: "premium";
557
+ /** User that boosted the chat */
558
+ user: User;
559
+ }
560
+
561
+ /** 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. */
562
+ export interface ChatBoostSourceGiftCode {
563
+ /** Source of the boost, always “gift_code” */
564
+ source: "gift_code";
565
+ /** User for which the gift code was created */
566
+ user: User;
567
+ }
568
+
569
+ /** 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. */
570
+ export interface ChatBoostSourceGiveaway {
571
+ /** Source of the boost, always “giveaway” */
572
+ source: "giveaway";
573
+ /** Identifier of a message in the chat with the giveaway; the message could have been deleted already */
574
+ giveaway_message_id: number;
575
+ }
576
+
577
+ /** This object contains information about a chat boost. */
578
+ export interface ChatBoost {
579
+ /** Unique identifier of the boost */
580
+ boost_id: string;
581
+ /** Point in time (Unix timestamp) when the chat was boosted */
582
+ add_date: number;
583
+ /** Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged */
584
+ expiration_date: number;
585
+ /** Source of the added boost */
586
+ source: ChatBoostSource;
587
+ }
588
+
589
+ /** This object represents a boost added to a chat or changed. */
590
+ export interface ChatBoostUpdated {
591
+ /** Chat which was boosted */
592
+ chat: Chat;
593
+ /** Infomation about the chat boost */
594
+ boost: ChatBoost;
595
+ }
596
+
597
+ /** This object represents a boost removed from a chat. */
598
+ export interface ChatBoostRemoved {
599
+ /** Chat which was boosted */
600
+ chat: Chat;
601
+ /** Unique identifier of the boost */
602
+ boost_id: string;
603
+ /** Point in time (Unix timestamp) when the boost was removed */
604
+ remove_date: number;
605
+ /** Source of the removed boost */
606
+ source: ChatBoostSource;
607
+ }
608
+
609
+ /** This object represents a list of boosts added to a chat by a user. */
610
+ export interface UserChatBoosts {
611
+ /** The list of boosts added to the chat by the user */
612
+ boosts: ChatBoost[];
486
613
  }