@telegram.ts/types 1.6.0 → 1.8.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,6 +59,8 @@ 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 {
@@ -164,6 +167,16 @@ export declare namespace Chat {
164
167
  GetChat,
165
168
  NonGroupGetChat,
166
169
  NonMultiUserGetChat {
170
+ /** For private chats, the date of birth of the user. Returned only in getChat. */
171
+ birthdate?: Birthdate;
172
+ /** For private chats with business accounts, the intro of the business. Returned only in getChat. */
173
+ business_intro?: BusinessIntro;
174
+ /** For private chats with business accounts, the location of the business. Returned only in getChat. */
175
+ business_location?: BusinessLocation;
176
+ /** For private chats with business accounts, the opening hours of the business. Returned only in getChat. */
177
+ business_opening_hours?: BusinessOpeningHours;
178
+ /** For private chats, the personal channel of the user. Returned only in getChat. */
179
+ personal_chat?: Chat.ChannelChat;
167
180
  /** Bio of the other party in a private chat. Returned only in getChat. */
168
181
  bio?: string;
169
182
  /** 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. */
@@ -295,19 +308,19 @@ export interface ChatAdministratorRights {
295
308
  can_change_info: boolean;
296
309
  /** True, if the user is allowed to invite new users to the chat */
297
310
  can_invite_users: boolean;
298
- /** True, if the administrator can post messages in the channel, or access channel statistics; channels only */
299
- can_post_messages?: boolean;
300
- /** True, if the administrator can edit messages of other users and can pin messages; channels only */
301
- can_edit_messages?: boolean;
302
- /** True, if the user is allowed to pin messages; groups and supergroups only */
303
- can_pin_messages?: boolean;
304
311
  /** True, if the administrator can post stories to the chat */
305
- can_post_stories?: boolean;
312
+ can_post_stories: boolean;
306
313
  /** True, if the administrator can edit stories posted by other users */
307
- can_edit_stories?: boolean;
314
+ can_edit_stories: boolean;
308
315
  /** 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 */
316
+ can_delete_stories: boolean;
317
+ /** True, if the administrator can post messages in the channel, or access channel statistics; for channels only */
318
+ can_post_messages?: boolean;
319
+ /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
320
+ can_edit_messages?: boolean;
321
+ /** True, if the user is allowed to pin messages; for groups and supergroups only */
322
+ can_pin_messages?: boolean;
323
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
311
324
  can_manage_topics?: boolean;
312
325
  }
313
326
 
@@ -380,19 +393,19 @@ export interface ChatMemberAdministrator {
380
393
  can_change_info: boolean;
381
394
  /** True, if the user is allowed to invite new users to the chat */
382
395
  can_invite_users: boolean;
383
- /** True, if the administrator can post messages in the channel, or access channel statistics; channels only */
384
- can_post_messages?: boolean;
385
- /** True, if the administrator can edit messages of other users and can pin messages; channels only */
386
- can_edit_messages?: boolean;
387
- /** True, if the user is allowed to pin messages; groups and supergroups only */
388
- can_pin_messages?: boolean;
389
396
  /** True, if the administrator can post stories to the chat */
390
- can_post_stories?: boolean;
397
+ can_post_stories: boolean;
391
398
  /** True, if the administrator can edit stories posted by other users */
392
- can_edit_stories?: boolean;
399
+ can_edit_stories: boolean;
393
400
  /** 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 */
401
+ can_delete_stories: boolean;
402
+ /** True, if the administrator can post messages in the channel, or access channel statistics; for channels only */
403
+ can_post_messages?: boolean;
404
+ /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
405
+ can_edit_messages?: boolean;
406
+ /** True, if the user is allowed to pin messages; for groups and supergroups only */
407
+ can_pin_messages?: boolean;
408
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
396
409
  can_manage_topics?: boolean;
397
410
  /** Custom title for this user */
398
411
  custom_title?: string;
@@ -512,6 +525,45 @@ export interface ChatPermissions {
512
525
  can_manage_topics?: boolean;
513
526
  }
514
527
 
528
+ export interface Birthdate {
529
+ /** Day of the user's birth; 1-31 */
530
+ day: number;
531
+ /** Month of the user's birth; 1-12 */
532
+ month: number;
533
+ /** Year of the user's birth */
534
+ year?: number;
535
+ }
536
+
537
+ export interface BusinessIntro {
538
+ /** Title text of the business intro */
539
+ title?: string;
540
+ /** Message text of the business intro */
541
+ message?: string;
542
+ /** Sticker of the business intro */
543
+ sticker?: Sticker;
544
+ }
545
+
546
+ export interface BusinessLocation {
547
+ /** Address of the business */
548
+ address: string;
549
+ /** Location of the business */
550
+ location?: Location;
551
+ }
552
+
553
+ export interface BusinessOpeningHoursInterval {
554
+ /** 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 */
555
+ opening_minute: number;
556
+ /** 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 */
557
+ closing_minute: number;
558
+ }
559
+
560
+ export interface BusinessOpeningHours {
561
+ /** Unique name of the time zone for which the opening hours are defined */
562
+ time_zone_name: string;
563
+ /** List of time intervals describing business opening hours */
564
+ opening_hours: BusinessOpeningHoursInterval[];
565
+ }
566
+
515
567
  /** Represents a location to which a chat is connected. */
516
568
  export interface ChatLocation {
517
569
  /** The location to which the supergroup is connected. Can't be a live location. */
@@ -611,3 +663,29 @@ export interface UserChatBoosts {
611
663
  /** The list of boosts added to the chat by the user */
612
664
  boosts: ChatBoost[];
613
665
  }
666
+
667
+ /** Describes the connection of the bot with a business account. */
668
+ export interface BusinessConnection {
669
+ /** Unique identifier of the business connection */
670
+ id: string;
671
+ /** Business account user that created the business connection */
672
+ user: User;
673
+ /** Identifier of a private chat with the user who created the business connection. */
674
+ user_chat_id: number;
675
+ /** Date the connection was established in Unix time */
676
+ date: number;
677
+ /** True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours */
678
+ can_reply: boolean;
679
+ /** True, if the connection is active */
680
+ is_enabled: boolean;
681
+ }
682
+
683
+ /** This object is received when messages are deleted from a connected business account. */
684
+ export interface BusinessMessagesDeleted {
685
+ /** Unique identifier of the business connection */
686
+ business_connection_id: string;
687
+ /** Information about a chat in the business account. The bot may not have access to the chat or the corresponding user. */
688
+ chat: Chat.PrivateChat;
689
+ /** A JSON-serialized list of identifiers of deleted messages in the chat of the business account */
690
+ message_ids: number[];
691
+ }
@@ -222,7 +222,7 @@ export interface WebAppInfo {
222
222
  url: string;
223
223
  }
224
224
 
225
- /** This object defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed. */
225
+ /** This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. */
226
226
  export interface KeyboardButtonRequestUsers {
227
227
  /** Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message */
228
228
  request_id: number;
@@ -232,9 +232,15 @@ export interface KeyboardButtonRequestUsers {
232
232
  user_is_premium?: boolean;
233
233
  /** The maximum number of users to be selected; 1-10. Defaults to 1. */
234
234
  max_quantity?: boolean;
235
+ /** Pass True to request the users' first and last name */
236
+ request_name?: boolean;
237
+ /** Pass True to request the users' username */
238
+ request_username?: boolean;
239
+ /** Pass True to request the users' photo */
240
+ request_photo?: boolean;
235
241
  }
236
242
 
237
- /** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */
243
+ /** This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate */
238
244
  export interface KeyboardButtonRequestChat {
239
245
  /** Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message */
240
246
  request_id: number;
@@ -252,4 +258,10 @@ export interface KeyboardButtonRequestChat {
252
258
  bot_administrator_rights?: ChatAdministratorRights;
253
259
  /** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
254
260
  bot_is_member?: boolean;
261
+ /** Pass True to request the chat's title */
262
+ request_title?: boolean;
263
+ /** Pass True to request the chat's username */
264
+ request_username?: boolean;
265
+ /** Pass True to request the chat's photo */
266
+ request_photo?: boolean;
255
267
  }
@@ -17,6 +17,8 @@ export declare namespace Message {
17
17
  sender_chat?: Chat;
18
18
  /** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
19
19
  date: number;
20
+ /** Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. */
21
+ business_connection_id?: string;
20
22
  /** Chat the message belongs to */
21
23
  chat: Chat;
22
24
  /** True, if the message is sent to a forum topic */
@@ -25,6 +27,8 @@ export declare namespace Message {
25
27
  export interface CommonMessage extends ServiceMessage {
26
28
  /** If the sender of the message boosted the chat, the number of boosts added by the user */
27
29
  sender_boost_count?: number;
30
+ /** The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. */
31
+ sender_business_bot?: User;
28
32
  /** Information about the original message for forwarded messages */
29
33
  forward_origin?: MessageOrigin;
30
34
  /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
@@ -43,6 +47,8 @@ export declare namespace Message {
43
47
  edit_date?: number;
44
48
  /** True, if the message can't be forwarded */
45
49
  has_protected_content?: true;
50
+ /** True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message */
51
+ is_from_offline?: true;
46
52
  /** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
47
53
  author_signature?: string;
48
54
  /** Options used for link preview generation for the message, if it is a text message and link preview options were changed */
@@ -518,9 +524,9 @@ export interface ExternalReplyInfo {
518
524
  export interface ReplyParameters {
519
525
  /** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified */
520
526
  message_id: number;
521
- /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername) */
527
+ /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account. */
522
528
  chat_id?: number | string;
523
- /** Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic. */
529
+ /** Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic. Always True for messages sent on behalf of a business account. */
524
530
  allow_sending_without_reply?: boolean;
525
531
  /** Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message. */
526
532
  quote?: string;
@@ -789,10 +795,10 @@ export interface Poll {
789
795
 
790
796
  /** This object represents a point on the map. */
791
797
  export interface Location {
792
- /** Longitude as defined by sender */
793
- longitude: number;
794
798
  /** Latitude as defined by sender */
795
799
  latitude: number;
800
+ /** Longitude as defined by sender */
801
+ longitude: number;
796
802
  /** The radius of uncertainty for the location, measured in meters; 0-1500 */
797
803
  horizontal_accuracy?: number;
798
804
  /** Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. */
@@ -885,16 +891,22 @@ export interface ChatBoostAdded {
885
891
  export interface UsersShared {
886
892
  /** Identifier of the request */
887
893
  request_id: number;
888
- /** Identifiers of the shared users. The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means. */
889
- user_ids: number[];
894
+ /** Information about users shared with the bot. */
895
+ users: SharedUser[];
890
896
  }
891
897
 
892
- /** This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. */
898
+ /** This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button. */
893
899
  export interface ChatShared {
894
900
  /** Identifier of the request */
895
901
  request_id: number;
896
902
  /** Identifier of the shared chat. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */
897
903
  chat_id: number;
904
+ /** Title of the chat, if the title was requested by the bot. */
905
+ title?: string;
906
+ /** Username of the chat, if the username was requested by the bot and available. */
907
+ username?: string;
908
+ /** Available sizes of the chat photo, if the photo was requested by the bot */
909
+ photo?: PhotoSize[];
898
910
  }
899
911
 
900
912
  /** This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess. */
@@ -928,6 +940,20 @@ export interface VideoChatParticipantsInvited {
928
940
  users: User[];
929
941
  }
930
942
 
943
+ /** This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUser button. */
944
+ export interface SharedUser {
945
+ /** Identifier of the shared user. 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 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. */
946
+ user_id: number;
947
+ /** First name of the user, if the name was requested by the bot */
948
+ first_name?: string;
949
+ /** Last name of the user, if the name was requested by the bot */
950
+ last_name?: string;
951
+ /** Username of the user, if the username was requested by the bot */
952
+ username?: string;
953
+ /** Available sizes of the chat photo, if the photo was requested by the bot */
954
+ photo?: PhotoSize[];
955
+ }
956
+
931
957
  /** This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. */
932
958
  export interface GiveawayCreated {}
933
959
 
@@ -1049,10 +1075,6 @@ export interface StickerSet {
1049
1075
  title: string;
1050
1076
  /** Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” */
1051
1077
  sticker_type: "regular" | "mask" | "custom_emoji";
1052
- /** True, if the sticker set contains animated stickers */
1053
- is_animated: boolean;
1054
- /** True, if the sticker set contains video stickers */
1055
- is_video: boolean;
1056
1078
  /** List of all set stickers */
1057
1079
  stickers: Sticker[];
1058
1080
  /** Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */
@@ -35,21 +35,21 @@ export interface EncryptedPassportElement {
35
35
  | "temporary_registration"
36
36
  | "phone_number"
37
37
  | "email";
38
- /** Base64-encoded encrypted Telegram Passport element data provided by the user. This data is available for types "personal_details", "passport", "driver_license", "identity_card", "internal_passport", and "address". It can be decrypted and verified using the accompanying EncryptedCredentials. */
38
+ /** Base64-encoded encrypted Telegram Passport element data provided by the user; available only for personal_details”, passport”, driver_license”, identity_card”, internal_passport and address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
39
39
  data?: string;
40
- /** User's verified phone number, available only for type "phone_number". */
40
+ /** User's verified phone number; available only for type "phone_number". */
41
41
  phone_number?: string;
42
- /** User's verified email address, available only for type "email". */
42
+ /** User's verified email address; available only for type "email". */
43
43
  email?: string;
44
- /** Array of encrypted files with documents provided by the user. This array is available for types "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". The files can be decrypted and verified using the accompanying EncryptedCredentials. */
44
+ /** Array of encrypted files with documents provided by the user; This array is available only for types "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". The files can be decrypted and verified using the accompanying EncryptedCredentials. */
45
45
  files?: PassportFile[];
46
- /** Encrypted file with the front side of the document, provided by the user. This file is available for types "passport", "driver_license", "identity_card", and "internal_passport". It can be decrypted and verified using the accompanying EncryptedCredentials. */
46
+ /** Encrypted file with the front side of the document, provided by the user; This file is available only for types "passport", "driver_license", "identity_card", and "internal_passport". It can be decrypted and verified using the accompanying EncryptedCredentials. */
47
47
  front_side?: PassportFile;
48
- /** Encrypted file with the reverse side of the document, provided by the user. This file is available for types "driver_license" and "identity_card". It can be decrypted and verified using the accompanying EncryptedCredentials. */
48
+ /** Encrypted file with the reverse side of the document, provided by the user; This file is available only for types "driver_license" and "identity_card". It can be decrypted and verified using the accompanying EncryptedCredentials. */
49
49
  reverse_side?: PassportFile;
50
- /** Encrypted file with the selfie of the user holding a document, provided by the user. This file is available for types "passport", "driver_license", "identity_card", and "internal_passport". It can be decrypted and verified using the accompanying EncryptedCredentials. */
50
+ /** Encrypted file with the selfie of the user holding a document, provided by the user. This file is available if requested for types "passport", "driver_license", "identity_card", and "internal_passport". It can be decrypted and verified using the accompanying EncryptedCredentials. */
51
51
  selfie?: PassportFile;
52
- /** Array of encrypted files with translated versions of documents provided by the user. This array is available for types "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". The
52
+ /** Array of encrypted files with translated versions of documents provided by the user; This array is available only for types "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", and "temporary_registration". The
53
53
 
54
54
  files can be decrypted and verified using the accompanying EncryptedCredentials. */
55
55
  translation?: PassportFile[];
@@ -1,11 +1,13 @@
1
1
  import type { ChosenInlineResult, InlineQuery } from "./inlineTypes";
2
2
  import type {
3
+ User,
3
4
  Chat,
4
5
  ChatJoinRequest,
5
6
  ChatMemberUpdated,
6
7
  ChatBoostRemoved,
7
8
  ChatBoostUpdated,
8
- User,
9
+ BusinessConnection,
10
+ BusinessMessagesDeleted,
9
11
  } from "./manageTypes";
10
12
  import type { CallbackQuery } from "./markupTypes";
11
13
  import type {
@@ -21,6 +23,11 @@ import type { PreCheckoutQuery, ShippingQuery } from "./invoiceTypes";
21
23
  * Namespace used internally to define more accurate message update types.
22
24
  */
23
25
  export declare namespace Update {
26
+ /** Internal type holding properties that message updates in private chats share. */
27
+ interface Private {
28
+ chat: Chat.PrivateChat;
29
+ }
30
+
24
31
  /**
25
32
  * Internal type holding properties that message updates in channels share.
26
33
  */
@@ -79,6 +86,18 @@ export interface Update {
79
86
  */
80
87
  edited_channel_post?: Message & Update.Edited & Update.Channel;
81
88
 
89
+ /** The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot */
90
+ business_connection?: BusinessConnection;
91
+
92
+ /** New non-service message from a connected business account */
93
+ business_message?: Message & Update.Private;
94
+
95
+ /** New version of a message from a connected business account */
96
+ edited_business_message?: Message & Update.Edited & Update.Private;
97
+
98
+ /** Messages were deleted from a connected business account */
99
+ deleted_business_messages?: BusinessMessagesDeleted;
100
+
82
101
  /** A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots. */
83
102
  message_reaction?: MessageReactionUpdated;
84
103