@telegram.ts/types 1.7.0 → 1.9.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.
@@ -3,6 +3,7 @@ import type {
3
3
  Message,
4
4
  PhotoSize,
5
5
  ReactionType,
6
+ Sticker,
6
7
  } from "./messageTypes";
7
8
  import type { Update } from "./updateTypes";
8
9
 
@@ -58,182 +59,455 @@ export interface UserFromGetMe extends User {
58
59
  can_read_all_group_messages: boolean;
59
60
  /** True, if the bot supports inline queries. Returned only in getMe. */
60
61
  supports_inline_queries: boolean;
62
+ /** True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe. */
63
+ can_connect_to_business?: boolean;
61
64
  }
62
65
 
63
66
  export declare namespace Chat {
64
- // ABSTRACT
65
- /** Internal type holding properties that all kinds of chats share. */
66
- interface AbstractChat {
67
+ /** Internal type for private chats */
68
+ export interface PrivateChat {
67
69
  /** Unique identifier for this chat. */
68
70
  id: number;
69
- /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */
70
- type: string;
71
- }
72
-
73
- // HELPERS
74
- /** Internal type holding properties that those chats with user names share. */
75
- interface UserNameChat {
71
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
72
+ type: "private";
73
+ /** Title, for supergroups, channels and group chats */
74
+ title?: undefined;
76
75
  /** Username, for private chats, supergroups and channels if available */
77
76
  username?: string;
78
- }
79
- /** Internal type holding properties that those chats with titles share. */
80
- interface TitleChat {
81
- /** Title, for supergroups, channels and group chats */
82
- title: string;
83
- }
84
-
85
- // ==> CHATS
86
- /** Internal type representing private chats. */
87
- export interface PrivateChat extends AbstractChat, UserNameChat {
88
- type: "private";
89
77
  /** First name of the other party in a private chat */
90
78
  first_name: string;
91
79
  /** Last name of the other party in a private chat */
92
80
  last_name?: string;
81
+ /** True, if the supergroup chat is a forum (has topics enabled) */
82
+ is_forum?: undefined;
93
83
  }
94
- /** Internal type representing group chats. */
95
- export interface GroupChat extends AbstractChat, TitleChat {
84
+ /** Internal type for group chats */
85
+ export interface GroupChat {
86
+ /** Unique identifier for this chat. */
87
+ id: number;
88
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
96
89
  type: "group";
90
+ /** Title, for supergroups, channels and group chats */
91
+ title: string;
92
+ /** Username, for private chats, supergroups and channels if available */
93
+ username?: undefined;
94
+ /** First name of the other party in a private chat */
95
+ first_name?: undefined;
96
+ /** Last name of the other party in a private chat */
97
+ last_name?: undefined;
98
+ /** True, if the supergroup chat is a forum (has topics enabled) */
99
+ is_forum?: undefined;
97
100
  }
98
- /** Internal type representing super group chats. */
99
- export interface SupergroupChat
100
- extends AbstractChat,
101
- UserNameChat,
102
- TitleChat {
101
+ /** Internal type for supergroup chats */
102
+ export interface SupergroupChat {
103
+ /** Unique identifier for this chat. */
104
+ id: number;
105
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
103
106
  type: "supergroup";
107
+ /** Title, for supergroups, channels and group chats */
108
+ title: string;
109
+ /** Username, for private chats, supergroups and channels if available */
110
+ username?: string;
111
+ /** First name of the other party in a private chat */
112
+ first_name?: undefined;
113
+ /** Last name of the other party in a private chat */
114
+ last_name?: undefined;
104
115
  /** True, if the supergroup chat is a forum (has topics enabled) */
105
116
  is_forum?: true;
106
117
  }
107
- /** Internal type representing channel chats. */
108
- export interface ChannelChat extends AbstractChat, UserNameChat, TitleChat {
118
+ /** Internal type for channel chats */
119
+ export interface ChannelChat {
120
+ /** Unique identifier for this chat. */
121
+ id: number;
122
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
109
123
  type: "channel";
124
+ /** Title, for supergroups, channels and group chats */
125
+ title: string;
126
+ /** Username, for private chats, supergroups and channels if available */
127
+ username?: string;
128
+ /** First name of the other party in a private chat */
129
+ first_name?: undefined;
130
+ /** Last name of the other party in a private chat */
131
+ last_name?: undefined;
132
+ /** True, if the supergroup chat is a forum (has topics enabled) */
133
+ is_forum?: undefined;
110
134
  }
135
+ }
111
136
 
112
- // GET CHAT HELPERS
113
- /** Internal type holding properties that those chats returned from `getChat` share. */
114
- interface GetChat {
115
- /** Chat photo. Returned only in getChat. */
137
+ /** This object represents a chat. */
138
+ export type Chat =
139
+ | Chat.PrivateChat
140
+ | Chat.GroupChat
141
+ | Chat.SupergroupChat
142
+ | Chat.ChannelChat;
143
+
144
+ export declare namespace ChatFullInfo {
145
+ /** Internal type for private chats */
146
+ export interface PrivateChat {
147
+ /** Unique identifier for this chat. */
148
+ id: number;
149
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
150
+ type: "private";
151
+ /** Title, for supergroups, channels and group chats */
152
+ title?: undefined;
153
+ /** Username, for private chats, supergroups and channels if available */
154
+ username?: string;
155
+ /** First name of the other party in a private chat */
156
+ first_name: string;
157
+ /** Last name of the other party in a private chat */
158
+ last_name?: string;
159
+ /** True, if the supergroup chat is a forum (has topics enabled) */
160
+ is_forum?: undefined;
161
+ /** 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. */
162
+ accent_color_id: number;
163
+ /** The maximum number of reactions that can be set on a message in the chat */
164
+ max_reaction_count: number;
165
+ /** Chat photo */
116
166
  photo?: ChatPhoto;
117
- /** The most recent pinned message (by sending date). Returned only in getChat. */
167
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
168
+ active_usernames?: string[];
169
+ /** For private chats, the date of birth of the user */
170
+ birthdate?: Birthdate;
171
+ /** For private chats with business accounts, the intro of the business */
172
+ business_intro?: BusinessIntro;
173
+ /** For private chats with business accounts, the location of the business */
174
+ business_location?: BusinessLocation;
175
+ /** For private chats with business accounts, the opening hours of the business */
176
+ business_opening_hours?: BusinessOpeningHours;
177
+ /** For private chats, the personal channel of the user */
178
+ personal_chat?: Chat;
179
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
180
+ available_reactions?: ReactionType[];
181
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
182
+ background_custom_emoji_id?: string;
183
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
184
+ profile_accent_color_id?: number;
185
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
186
+ profile_background_custom_emoji_id?: string;
187
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
188
+ emoji_status_custom_emoji_id?: string;
189
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
190
+ emoji_status_expiration_date?: number;
191
+ /** Bio of the other party in a private chat */
192
+ bio?: string;
193
+ /** 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 */
194
+ has_private_forwards?: true;
195
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
196
+ has_restricted_voice_and_video_messages?: true;
197
+ /** True, if users need to join the supergroup before they can send messages */
198
+ join_to_send_messages?: undefined;
199
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
200
+ join_by_request?: undefined;
201
+ /** Description, for groups, supergroups and channel chats */
202
+ description?: undefined;
203
+ /** Primary invite link, for groups, supergroups and channel chats */
204
+ invite_link?: undefined;
205
+ /** The most recent pinned message (by sending date) */
118
206
  pinned_message?: Message;
119
- /** The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */
207
+ /** Default chat member permissions, for groups and supergroups */
208
+ permissions?: undefined;
209
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
210
+ slow_mode_delay?: undefined;
211
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
212
+ unrestrict_boost_count?: undefined;
213
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
120
214
  message_auto_delete_time?: number;
121
- /** True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */
215
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
216
+ has_aggressive_anti_spam_enabled?: undefined;
217
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
218
+ has_hidden_members?: undefined;
219
+ /** True, if messages from the chat can't be forwarded to other chats */
122
220
  has_protected_content?: true;
221
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
222
+ has_visible_history?: undefined;
223
+ /** For supergroups, name of the group sticker set */
224
+ sticker_set_name?: undefined;
225
+ /** True, if the bot can change the group sticker set */
226
+ can_set_sticker_set?: undefined;
227
+ /** 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. */
228
+ custom_emoji_sticker_set_name?: undefined;
229
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
230
+ linked_chat_id?: undefined;
231
+ /** For supergroups, the location to which the supergroup is connected */
232
+ location?: undefined;
123
233
  }
124
- /** Internal type holding properties that those private, supergroup, and channel chats returned from `getChat` share. */
125
- interface NonGroupGetChat {
126
- /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */
127
- active_usernames?: string[];
128
- }
129
- /** Internal type holding properties that those group, supergroup, and channel chats returned from `getChat` share. */
130
- interface NonPrivateGetChat {
131
- /** Description, for groups, supergroups and channel chats. Returned only in getChat. */
234
+ /** Internal type for group chats */
235
+ export interface GroupChat {
236
+ /** Unique identifier for this chat. */
237
+ id: number;
238
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
239
+ type: "group";
240
+ /** Title, for supergroups, channels and group chats */
241
+ title?: string;
242
+ /** Username, for private chats, supergroups and channels if available */
243
+ username?: undefined;
244
+ /** First name of the other party in a private chat */
245
+ first_name?: undefined;
246
+ /** Last name of the other party in a private chat */
247
+ last_name?: undefined;
248
+ /** True, if the supergroup chat is a forum (has topics enabled) */
249
+ is_forum?: undefined;
250
+ /** 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. */
251
+ accent_color_id: number;
252
+ /** The maximum number of reactions that can be set on a message in the chat */
253
+ max_reaction_count: number;
254
+ /** Chat photo */
255
+ photo?: ChatPhoto;
256
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
257
+ active_usernames?: undefined;
258
+ /** For private chats, the date of birth of the user */
259
+ birthdate?: undefined;
260
+ /** For private chats with business accounts, the intro of the business */
261
+ business_intro?: undefined;
262
+ /** For private chats with business accounts, the location of the business */
263
+ business_location?: undefined;
264
+ /** For private chats with business accounts, the opening hours of the business */
265
+ business_opening_hours?: undefined;
266
+ /** For private chats, the personal channel of the user */
267
+ personal_chat?: undefined;
268
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
269
+ available_reactions?: ReactionType[];
270
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
271
+ background_custom_emoji_id?: string;
272
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
273
+ profile_accent_color_id?: number;
274
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
275
+ profile_background_custom_emoji_id?: string;
276
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
277
+ emoji_status_custom_emoji_id?: string;
278
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
279
+ emoji_status_expiration_date?: number;
280
+ /** Bio of the other party in a private chat */
281
+ bio?: undefined;
282
+ /** 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 */
283
+ has_private_forwards?: undefined;
284
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
285
+ has_restricted_voice_and_video_messages?: undefined;
286
+ /** True, if users need to join the supergroup before they can send messages */
287
+ join_to_send_messages?: undefined;
288
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
289
+ join_by_request?: undefined;
290
+ /** Description, for groups, supergroups and channel chats */
132
291
  description?: string;
133
- /** Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */
292
+ /** Primary invite link, for groups, supergroups and channel chats */
134
293
  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[];
137
- }
138
- /** Internal type holding properties that those group and supergroup chats returned from `getChat` share. */
139
- interface MultiUserGetChat {
140
- /** Default chat member permissions, for groups and supergroups. Returned only in getChat. */
294
+ /** The most recent pinned message (by sending date) */
295
+ pinned_message?: Message;
296
+ /** Default chat member permissions, for groups and supergroups */
141
297
  permissions?: ChatPermissions;
298
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
299
+ slow_mode_delay?: undefined;
300
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
301
+ unrestrict_boost_count?: undefined;
302
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
303
+ message_auto_delete_time?: number;
304
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
305
+ has_aggressive_anti_spam_enabled?: undefined;
306
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
307
+ has_hidden_members?: true;
308
+ /** True, if messages from the chat can't be forwarded to other chats */
309
+ has_protected_content?: true;
310
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
311
+ has_visible_history?: true;
312
+ /** For supergroups, name of the group sticker set */
313
+ sticker_set_name?: undefined;
314
+ /** True, if the bot can change the group sticker set */
315
+ can_set_sticker_set?: true;
316
+ /** 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. */
317
+ custom_emoji_sticker_set_name?: undefined;
318
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
319
+ linked_chat_id?: undefined;
320
+ /** For supergroups, the location to which the supergroup is connected */
321
+ location?: undefined;
142
322
  }
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. */
323
+ /** Internal type for supergroup chats */
324
+ export interface SupergroupChat {
325
+ /** Unique identifier for this chat. */
326
+ id: number;
327
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
328
+ type: "supergroup";
329
+ /** Title, for supergroups, channels and group chats */
330
+ title?: string;
331
+ /** Username, for private chats, supergroups and channels if available */
332
+ username?: string;
333
+ /** First name of the other party in a private chat */
334
+ first_name?: undefined;
335
+ /** Last name of the other party in a private chat */
336
+ last_name?: undefined;
337
+ /** True, if the supergroup chat is a forum (has topics enabled) */
338
+ is_forum?: true;
339
+ /** 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. */
146
340
  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. */
341
+ /** The maximum number of reactions that can be set on a message in the chat */
342
+ max_reaction_count: number;
343
+ /** Chat photo */
344
+ photo?: ChatPhoto;
345
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
346
+ active_usernames?: string[];
347
+ /** For private chats, the date of birth of the user */
348
+ birthdate?: undefined;
349
+ /** For private chats with business accounts, the intro of the business */
350
+ business_intro?: undefined;
351
+ /** For private chats with business accounts, the location of the business */
352
+ business_location?: undefined;
353
+ /** For private chats with business accounts, the opening hours of the business */
354
+ business_opening_hours?: undefined;
355
+ /** For private chats, the personal channel of the user */
356
+ personal_chat?: undefined;
357
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
358
+ available_reactions?: ReactionType[];
359
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
148
360
  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. */
361
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
362
+ profile_accent_color_id?: number;
363
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
364
+ profile_background_custom_emoji_id?: string;
365
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
150
366
  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. */
367
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
152
368
  emoji_status_expiration_date?: number;
153
- }
154
- /** Internal type holding properties that those supergroup and channel chats returned from `getChat` share. */
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. */
157
- linked_chat_id?: number;
158
- }
159
-
160
- // ==> GET CHATS
161
- /** Internal type representing private chats returned from `getChat`. */
162
- export interface PrivateGetChat
163
- extends PrivateChat,
164
- GetChat,
165
- NonGroupGetChat,
166
- NonMultiUserGetChat {
167
- /** Bio of the other party in a private chat. Returned only in getChat. */
369
+ /** Bio of the other party in a private chat */
168
370
  bio?: string;
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. */
170
- has_private_forwards?: true;
171
- /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. */
172
- has_restricted_voice_and_video_messages?: true;
173
- }
174
- /** Internal type representing group chats returned from `getChat`. */
175
- export interface GroupGetChat
176
- extends GroupChat,
177
- GetChat,
178
- NonPrivateGetChat,
179
- MultiUserGetChat {}
180
- /** Internal type representing supergroup chats returned from `getChat`. */
181
- export interface SupergroupGetChat
182
- extends SupergroupChat,
183
- GetChat,
184
- NonGroupGetChat,
185
- NonPrivateGetChat,
186
- MultiUserGetChat,
187
- LargeGetChat {
188
- /** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
371
+ /** 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 */
372
+ has_private_forwards?: undefined;
373
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
374
+ has_restricted_voice_and_video_messages?: undefined;
375
+ /** True, if users need to join the supergroup before they can send messages */
189
376
  join_to_send_messages?: true;
190
- /** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */
377
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
191
378
  join_by_request?: true;
192
- /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
379
+ /** Description, for groups, supergroups and channel chats */
380
+ description?: string;
381
+ /** Primary invite link, for groups, supergroups and channel chats */
382
+ invite_link?: string;
383
+ /** The most recent pinned message (by sending date) */
384
+ pinned_message?: Message;
385
+ /** Default chat member permissions, for groups and supergroups */
386
+ permissions?: ChatPermissions;
387
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
193
388
  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. */
389
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
195
390
  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;
198
- /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */
391
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
392
+ message_auto_delete_time?: number;
393
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
199
394
  has_aggressive_anti_spam_enabled?: true;
200
- /** For supergroups, name of group sticker set. Returned only in getChat. */
395
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
396
+ has_hidden_members?: true;
397
+ /** True, if messages from the chat can't be forwarded to other chats */
398
+ has_protected_content?: true;
399
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
400
+ has_visible_history?: true;
401
+ /** For supergroups, name of the group sticker set */
201
402
  sticker_set_name?: string;
202
- /** True, if the bot can change the group sticker set. Returned only in getChat. */
403
+ /** True, if the bot can change the group sticker set */
203
404
  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. */
405
+ /** 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. */
205
406
  custom_emoji_sticker_set_name?: string;
206
- /** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
407
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
408
+ linked_chat_id?: number;
409
+ /** For supergroups, the location to which the supergroup is connected */
207
410
  location?: ChatLocation;
208
411
  }
209
- /** Internal type representing channel chats returned from `getChat`. */
210
- export interface ChannelGetChat
211
- extends ChannelChat,
212
- GetChat,
213
- NonGroupGetChat,
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. */
412
+ /** Internal type for channel chats */
413
+ export interface ChannelChat {
414
+ /** Unique identifier for this chat. */
415
+ id: number;
416
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
417
+ type: "channel";
418
+ /** Title, for supergroups, channels and group chats */
419
+ title?: string;
420
+ /** Username, for private chats, supergroups and channels if available */
421
+ username?: string;
422
+ /** First name of the other party in a private chat */
423
+ first_name?: undefined;
424
+ /** Last name of the other party in a private chat */
425
+ last_name?: undefined;
426
+ /** True, if the supergroup chat is a forum (has topics enabled) */
427
+ is_forum?: undefined;
428
+ /** 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. */
429
+ accent_color_id: number;
430
+ /** The maximum number of reactions that can be set on a message in the chat */
431
+ max_reaction_count: number;
432
+ /** Chat photo */
433
+ photo?: ChatPhoto;
434
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
435
+ active_usernames?: string[];
436
+ /** For private chats, the date of birth of the user */
437
+ birthdate?: undefined;
438
+ /** For private chats with business accounts, the intro of the business */
439
+ business_intro?: undefined;
440
+ /** For private chats with business accounts, the location of the business */
441
+ business_location?: undefined;
442
+ /** For private chats with business accounts, the opening hours of the business */
443
+ business_opening_hours?: undefined;
444
+ /** For private chats, the personal channel of the user */
445
+ personal_chat?: undefined;
446
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
447
+ available_reactions?: ReactionType[];
448
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
449
+ background_custom_emoji_id?: string;
450
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
218
451
  profile_accent_color_id?: number;
219
- /** Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat. */
452
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
220
453
  profile_background_custom_emoji_id?: string;
454
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
455
+ emoji_status_custom_emoji_id?: string;
456
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
457
+ emoji_status_expiration_date?: number;
458
+ /** Bio of the other party in a private chat */
459
+ bio?: undefined;
460
+ /** 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 */
461
+ has_private_forwards?: undefined;
462
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
463
+ has_restricted_voice_and_video_messages?: undefined;
464
+ /** True, if users need to join the supergroup before they can send messages */
465
+ join_to_send_messages?: true;
466
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
467
+ join_by_request?: undefined;
468
+ /** Description, for groups, supergroups and channel chats */
469
+ description?: string;
470
+ /** Primary invite link, for groups, supergroups and channel chats */
471
+ invite_link?: string;
472
+ /** The most recent pinned message (by sending date) */
473
+ pinned_message?: Message;
474
+ /** Default chat member permissions, for groups and supergroups */
475
+ permissions?: undefined;
476
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
477
+ slow_mode_delay?: undefined;
478
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
479
+ unrestrict_boost_count?: undefined;
480
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
481
+ message_auto_delete_time?: number;
482
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
483
+ has_aggressive_anti_spam_enabled?: undefined;
484
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
485
+ has_hidden_members?: undefined;
486
+ /** True, if messages from the chat can't be forwarded to other chats */
487
+ has_protected_content?: true;
488
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
489
+ has_visible_history?: undefined;
490
+ /** For supergroups, name of the group sticker set */
491
+ sticker_set_name?: undefined;
492
+ /** True, if the bot can change the group sticker set */
493
+ can_set_sticker_set?: undefined;
494
+ /** 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. */
495
+ custom_emoji_sticker_set_name?: undefined;
496
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
497
+ linked_chat_id?: number;
498
+ /** For supergroups, the location to which the supergroup is connected */
499
+ location?: undefined;
221
500
  }
222
501
  }
223
502
 
224
- /** This object represents a chat. */
225
- export type Chat =
226
- | Chat.PrivateChat
227
- | Chat.GroupChat
228
- | Chat.SupergroupChat
229
- | Chat.ChannelChat;
230
-
231
- /** This object represents a Telegram user or bot that was returned by `getChat`. */
232
- export type ChatFromGetChat =
233
- | Chat.PrivateGetChat
234
- | Chat.GroupGetChat
235
- | Chat.SupergroupGetChat
236
- | Chat.ChannelGetChat;
503
+ /** This object contains full information about a chat. */
504
+ export type ChatFullInfo =
505
+ | ChatFullInfo.PrivateChat
506
+ | ChatFullInfo.GroupChat
507
+ | ChatFullInfo.SupergroupChat
508
+ | ChatFullInfo.ChannelChat;
509
+ /** @deprecated use ChatFullInfo instead */
510
+ export type ChatFromGetChat = ChatFullInfo;
237
511
 
238
512
  /** This object represent a user's profile pictures. */
239
513
  export interface UserProfilePhotos {
@@ -295,19 +569,19 @@ export interface ChatAdministratorRights {
295
569
  can_change_info: boolean;
296
570
  /** True, if the user is allowed to invite new users to the chat */
297
571
  can_invite_users: boolean;
298
- /** True, if the administrator can post messages in the channel, or access channel statistics; channels only */
572
+ /** True, if the administrator can post stories to the chat */
573
+ can_post_stories: boolean;
574
+ /** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
575
+ can_edit_stories: boolean;
576
+ /** True, if the administrator can delete stories posted by other users */
577
+ can_delete_stories: boolean;
578
+ /** True, if the administrator can post messages in the channel, or access channel statistics; for channels only */
299
579
  can_post_messages?: boolean;
300
- /** True, if the administrator can edit messages of other users and can pin messages; channels only */
580
+ /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
301
581
  can_edit_messages?: boolean;
302
- /** True, if the user is allowed to pin messages; groups and supergroups only */
582
+ /** True, if the user is allowed to pin messages; for groups and supergroups only */
303
583
  can_pin_messages?: boolean;
304
- /** True, if the administrator can post stories to the chat */
305
- can_post_stories?: boolean;
306
- /** True, if the administrator can edit stories posted by other users */
307
- can_edit_stories?: boolean;
308
- /** True, if the administrator can delete stories posted by other users; channels only */
309
- can_delete_stories?: boolean;
310
- /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
584
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
311
585
  can_manage_topics?: boolean;
312
586
  }
313
587
 
@@ -325,6 +599,8 @@ export interface ChatMemberUpdated {
325
599
  new_chat_member: ChatMember;
326
600
  /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */
327
601
  invite_link?: ChatInviteLink;
602
+ /** True, if the user joined the chat after sending a direct join request without using an invite link without using an invite link and being approved by an administrator */
603
+ via_join_request?: boolean;
328
604
  /** True, if the user joined the chat via a chat folder invite link */
329
605
  via_chat_folder_invite_link?: boolean;
330
606
  }
@@ -380,19 +656,19 @@ export interface ChatMemberAdministrator {
380
656
  can_change_info: boolean;
381
657
  /** True, if the user is allowed to invite new users to the chat */
382
658
  can_invite_users: boolean;
383
- /** True, if the administrator can post messages in the channel, or access channel statistics; channels only */
659
+ /** True, if the administrator can post stories to the chat */
660
+ can_post_stories: boolean;
661
+ /** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
662
+ can_edit_stories: boolean;
663
+ /** True, if the administrator can delete stories posted by other users */
664
+ can_delete_stories: boolean;
665
+ /** True, if the administrator can post messages in the channel, or access channel statistics; for channels only */
384
666
  can_post_messages?: boolean;
385
- /** True, if the administrator can edit messages of other users and can pin messages; channels only */
667
+ /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
386
668
  can_edit_messages?: boolean;
387
- /** True, if the user is allowed to pin messages; groups and supergroups only */
669
+ /** True, if the user is allowed to pin messages; for groups and supergroups only */
388
670
  can_pin_messages?: boolean;
389
- /** True, if the administrator can post stories to the chat */
390
- can_post_stories?: boolean;
391
- /** True, if the administrator can edit stories posted by other users */
392
- can_edit_stories?: boolean;
393
- /** True, if the administrator can delete stories posted by other users */
394
- can_delete_stories?: boolean;
395
- /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
671
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
396
672
  can_manage_topics?: boolean;
397
673
  /** Custom title for this user */
398
674
  custom_title?: string;
@@ -512,6 +788,50 @@ export interface ChatPermissions {
512
788
  can_manage_topics?: boolean;
513
789
  }
514
790
 
791
+ /** Describes the birthdate of a user. */
792
+ export interface Birthdate {
793
+ /** Day of the user's birth; 1-31 */
794
+ day: number;
795
+ /** Month of the user's birth; 1-12 */
796
+ month: number;
797
+ /** Year of the user's birth */
798
+ year?: number;
799
+ }
800
+
801
+ /** Contains information about the start page settings of a Telegram Business account. */
802
+ export interface BusinessIntro {
803
+ /** Title text of the business intro */
804
+ title?: string;
805
+ /** Message text of the business intro */
806
+ message?: string;
807
+ /** Sticker of the business intro */
808
+ sticker?: Sticker;
809
+ }
810
+
811
+ /** Contains information about the location of a Telegram Business account. */
812
+ export interface BusinessLocation {
813
+ /** Address of the business */
814
+ address: string;
815
+ /** Location of the business */
816
+ location?: Location;
817
+ }
818
+
819
+ /** Describes an interval of time during which a business is open. */
820
+ export interface BusinessOpeningHoursInterval {
821
+ /** The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60 */
822
+ opening_minute: number;
823
+ /** The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60 */
824
+ closing_minute: number;
825
+ }
826
+
827
+ /** Describes the opening hours of a business. */
828
+ export interface BusinessOpeningHours {
829
+ /** Unique name of the time zone for which the opening hours are defined */
830
+ time_zone_name: string;
831
+ /** List of time intervals describing business opening hours */
832
+ opening_hours: BusinessOpeningHoursInterval[];
833
+ }
834
+
515
835
  /** Represents a location to which a chat is connected. */
516
836
  export interface ChatLocation {
517
837
  /** The location to which the supergroup is connected. Can't be a live location. */
@@ -572,6 +892,10 @@ export interface ChatBoostSourceGiveaway {
572
892
  source: "giveaway";
573
893
  /** Identifier of a message in the chat with the giveaway; the message could have been deleted already */
574
894
  giveaway_message_id: number;
895
+ /** User that won the prize in the giveaway if any */
896
+ user?: User;
897
+ /** True, if the giveaway was completed, but there was no user to win the prize */
898
+ is_unclaimed?: true;
575
899
  }
576
900
 
577
901
  /** This object contains information about a chat boost. */
@@ -590,7 +914,7 @@ export interface ChatBoost {
590
914
  export interface ChatBoostUpdated {
591
915
  /** Chat which was boosted */
592
916
  chat: Chat;
593
- /** Infomation about the chat boost */
917
+ /** Information about the chat boost */
594
918
  boost: ChatBoost;
595
919
  }
596
920
 
@@ -611,3 +935,29 @@ export interface UserChatBoosts {
611
935
  /** The list of boosts added to the chat by the user */
612
936
  boosts: ChatBoost[];
613
937
  }
938
+
939
+ /** Describes the connection of the bot with a business account. */
940
+ export interface BusinessConnection {
941
+ /** Unique identifier of the business connection */
942
+ id: string;
943
+ /** Business account user that created the business connection */
944
+ user: User;
945
+ /** Identifier of a private chat with the user who created the business connection. */
946
+ user_chat_id: number;
947
+ /** Date the connection was established in Unix time */
948
+ date: number;
949
+ /** True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours */
950
+ can_reply: boolean;
951
+ /** True, if the connection is active */
952
+ is_enabled: boolean;
953
+ }
954
+
955
+ /** This object is received when messages are deleted from a connected business account. */
956
+ export interface BusinessMessagesDeleted {
957
+ /** Unique identifier of the business connection */
958
+ business_connection_id: string;
959
+ /** Information about a chat in the business account. The bot may not have access to the chat or the corresponding user. */
960
+ chat: Chat.PrivateChat;
961
+ /** The list of identifiers of deleted messages in the chat of the business account */
962
+ message_ids: number[];
963
+ }