@mtkruto/node 0.1.133 → 0.1.134

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.
Files changed (162) hide show
  1. package/esm/3_errors.d.ts +519 -510
  2. package/esm/3_errors.js +521 -509
  3. package/esm/3_types.d.ts +16 -7
  4. package/esm/3_types.js +16 -7
  5. package/esm/4_constants.d.ts +1 -1
  6. package/esm/4_constants.js +1 -1
  7. package/esm/4_errors.d.ts +7 -12
  8. package/esm/4_errors.js +6 -7
  9. package/esm/5_client.d.ts +3 -3
  10. package/esm/5_client.js +3 -3
  11. package/esm/client/0_utilities.d.ts +28 -0
  12. package/esm/client/0_utilities.js +10 -0
  13. package/esm/client/1_composer.d.ts +30 -0
  14. package/esm/client/{4_composer.js → 1_composer.js} +3 -2
  15. package/esm/client/2_client_plain.d.ts +1 -1
  16. package/esm/client/2_client_plain.js +1 -1
  17. package/{script/client/3_types.d.ts → esm/client/3_params.d.ts} +68 -177
  18. package/esm/client/3_params.js +1 -0
  19. package/esm/client/{5_client.d.ts → 4_client.d.ts} +57 -25
  20. package/esm/client/{5_client.js → 4_client.js} +347 -160
  21. package/esm/client/5_composer.d.ts +4 -0
  22. package/esm/client/5_composer.js +3 -0
  23. package/esm/storage/0_storage.d.ts +4 -1
  24. package/esm/storage/0_storage.js +36 -7
  25. package/esm/storage/1_storage_indexed_db.d.ts +6 -2
  26. package/esm/storage/1_storage_indexed_db.js +7 -5
  27. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  28. package/esm/storage/1_storage_local_storage.js +1 -1
  29. package/esm/storage/1_storage_memory.d.ts +1 -1
  30. package/esm/storage/1_storage_memory.js +1 -1
  31. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  32. package/esm/storage/1_storage_session_storage.js +1 -1
  33. package/esm/tl/3_utilities.d.ts +1 -0
  34. package/esm/tl/3_utilities.js +14 -0
  35. package/esm/tl/6_message.js +1 -1
  36. package/esm/types/0_authorization_state.d.ts +5 -0
  37. package/esm/types/0_authorization_state.js +1 -0
  38. package/esm/types/0_connection_state.d.ts +17 -0
  39. package/esm/types/0_connection_state.js +1 -0
  40. package/esm/types/0_login_url.d.ts +0 -4
  41. package/esm/types/0_mask_position.d.ts +0 -4
  42. package/esm/types/0_message_entity.d.ts +0 -2
  43. package/esm/types/0_message_identifier.d.ts +4 -0
  44. package/esm/types/0_message_identifier.js +1 -0
  45. package/esm/types/0_network_statistics_entry.d.ts +4 -0
  46. package/esm/types/0_network_statistics_entry.js +1 -0
  47. package/esm/types/0_reaction.d.ts +1 -0
  48. package/esm/types/0_reaction.js +13 -0
  49. package/esm/types/1__getters.d.ts +3 -0
  50. package/esm/types/1_chat_p.d.ts +1 -0
  51. package/esm/types/1_keyboard_button.d.ts +1 -23
  52. package/esm/types/1_network_statistics.d.ts +5 -0
  53. package/esm/types/1_network_statistics.js +1 -0
  54. package/esm/types/1_poll.d.ts +0 -13
  55. package/esm/types/1_reaction_count.d.ts +7 -0
  56. package/esm/types/1_reaction_count.js +6 -0
  57. package/esm/types/2_game.d.ts +0 -7
  58. package/esm/types/2_inline_keyboard_button.d.ts +0 -8
  59. package/esm/types/2_inline_query.d.ts +0 -6
  60. package/esm/types/2_message_interactions.d.ts +8 -0
  61. package/esm/types/2_message_interactions.js +1 -0
  62. package/esm/types/2_message_reaction_count.d.ts +8 -0
  63. package/esm/types/2_message_reaction_count.js +1 -0
  64. package/esm/types/2_reply_keyboard_markup.d.ts +0 -7
  65. package/esm/types/3_inline_keyboard_markup.d.ts +0 -2
  66. package/{script/types/3_message.d.ts → esm/types/4_message.d.ts} +225 -7
  67. package/esm/types/{3_message.js → 4_message.js} +14 -24
  68. package/{script/types/4_callback_query.d.ts → esm/types/5_callback_query.d.ts} +1 -1
  69. package/esm/types/{4_chat.d.ts → 5_chat.d.ts} +3 -3
  70. package/esm/types/{4_chat.js → 5_chat.js} +2 -2
  71. package/esm/types/6_update.d.ts +134 -0
  72. package/esm/types/6_update.js +1 -0
  73. package/package.json +1 -1
  74. package/script/3_errors.d.ts +519 -510
  75. package/script/3_errors.js +533 -520
  76. package/script/3_types.d.ts +16 -7
  77. package/script/3_types.js +16 -7
  78. package/script/4_constants.d.ts +1 -1
  79. package/script/4_constants.js +1 -1
  80. package/script/4_errors.d.ts +7 -12
  81. package/script/4_errors.js +5 -6
  82. package/script/5_client.d.ts +3 -3
  83. package/script/5_client.js +3 -3
  84. package/script/client/0_utilities.d.ts +28 -0
  85. package/script/client/0_utilities.js +12 -1
  86. package/script/client/1_composer.d.ts +30 -0
  87. package/script/client/{4_composer.js → 1_composer.js} +5 -4
  88. package/script/client/2_client_plain.d.ts +1 -1
  89. package/script/client/2_client_plain.js +2 -2
  90. package/{esm/client/3_types.d.ts → script/client/3_params.d.ts} +68 -177
  91. package/script/client/3_params.js +2 -0
  92. package/script/client/{5_client.d.ts → 4_client.d.ts} +57 -25
  93. package/script/client/{5_client.js → 4_client.js} +353 -166
  94. package/script/client/5_composer.d.ts +4 -0
  95. package/script/client/{6_composer.js → 5_composer.js} +2 -2
  96. package/script/storage/0_storage.d.ts +4 -1
  97. package/script/storage/0_storage.js +36 -7
  98. package/script/storage/1_storage_indexed_db.d.ts +6 -2
  99. package/script/storage/1_storage_indexed_db.js +7 -5
  100. package/script/storage/1_storage_local_storage.d.ts +1 -1
  101. package/script/storage/1_storage_local_storage.js +1 -1
  102. package/script/storage/1_storage_memory.d.ts +1 -1
  103. package/script/storage/1_storage_memory.js +1 -1
  104. package/script/storage/1_storage_session_storage.d.ts +1 -1
  105. package/script/storage/1_storage_session_storage.js +1 -1
  106. package/script/tl/3_utilities.d.ts +1 -0
  107. package/script/tl/3_utilities.js +16 -1
  108. package/script/tl/6_message.js +1 -1
  109. package/script/types/0_authorization_state.d.ts +5 -0
  110. package/script/types/0_authorization_state.js +2 -0
  111. package/script/types/0_connection_state.d.ts +17 -0
  112. package/script/types/0_connection_state.js +2 -0
  113. package/script/types/0_login_url.d.ts +0 -4
  114. package/script/types/0_mask_position.d.ts +0 -4
  115. package/script/types/0_message_entity.d.ts +0 -2
  116. package/script/types/0_message_identifier.d.ts +4 -0
  117. package/script/types/0_message_identifier.js +2 -0
  118. package/script/types/0_network_statistics_entry.d.ts +4 -0
  119. package/script/types/0_network_statistics_entry.js +2 -0
  120. package/script/types/0_reaction.d.ts +1 -0
  121. package/script/types/0_reaction.js +15 -1
  122. package/script/types/1__getters.d.ts +3 -0
  123. package/script/types/1_chat_p.d.ts +1 -0
  124. package/script/types/1_keyboard_button.d.ts +1 -23
  125. package/script/types/1_network_statistics.d.ts +5 -0
  126. package/script/types/1_network_statistics.js +2 -0
  127. package/script/types/1_poll.d.ts +0 -13
  128. package/script/types/1_reaction_count.d.ts +7 -0
  129. package/script/types/1_reaction_count.js +10 -0
  130. package/script/types/2_game.d.ts +0 -7
  131. package/script/types/2_inline_keyboard_button.d.ts +0 -8
  132. package/script/types/2_inline_query.d.ts +0 -6
  133. package/script/types/2_message_interactions.d.ts +8 -0
  134. package/script/types/2_message_interactions.js +2 -0
  135. package/script/types/2_message_reaction_count.d.ts +8 -0
  136. package/script/types/2_message_reaction_count.js +2 -0
  137. package/script/types/2_reply_keyboard_markup.d.ts +0 -7
  138. package/script/types/3_inline_keyboard_markup.d.ts +0 -2
  139. package/{esm/types/3_message.d.ts → script/types/4_message.d.ts} +225 -7
  140. package/script/types/{3_message.js → 4_message.js} +15 -25
  141. package/{esm/types/4_callback_query.d.ts → script/types/5_callback_query.d.ts} +1 -1
  142. package/script/types/{4_chat.d.ts → 5_chat.d.ts} +3 -3
  143. package/script/types/{4_chat.js → 5_chat.js} +3 -3
  144. package/script/types/6_update.d.ts +134 -0
  145. package/script/types/6_update.js +2 -0
  146. package/esm/client/3_types.js +0 -11
  147. package/esm/client/4_composer.d.ts +0 -31
  148. package/esm/client/6_composer.d.ts +0 -4
  149. package/esm/client/6_composer.js +0 -3
  150. package/script/client/3_types.js +0 -15
  151. package/script/client/4_composer.d.ts +0 -31
  152. package/script/client/6_composer.d.ts +0 -4
  153. /package/esm/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
  154. /package/esm/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
  155. /package/esm/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
  156. /package/esm/types/{0_audio.js → 1_audio.js} +0 -0
  157. /package/esm/types/{4_callback_query.js → 5_callback_query.js} +0 -0
  158. /package/script/client/{1_client_abstract.d.ts → 0_client_abstract.d.ts} +0 -0
  159. /package/script/client/{1_client_abstract.js → 0_client_abstract.js} +0 -0
  160. /package/script/types/{0_audio.d.ts → 1_audio.d.ts} +0 -0
  161. /package/script/types/{0_audio.js → 1_audio.js} +0 -0
  162. /package/script/types/{4_callback_query.js → 5_callback_query.js} +0 -0
@@ -4,37 +4,30 @@ import { WebAppInfo } from "./0_web_app_info.js";
4
4
  import { UsernameResolver } from "./1__getters.js";
5
5
  /** @unlisted */
6
6
  export interface InlineKeyboardButtonBase {
7
- /** Label text on the button */
8
7
  text: string;
9
8
  }
10
9
  /** @unlisted */
11
10
  export interface InlineKeyboardButtonURL extends InlineKeyboardButtonBase {
12
- /** HTTP or tg:// URL to be opened when the button is pressed. Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
13
11
  url: string;
14
12
  }
15
13
  /** @unlisted */
16
14
  export interface InlineKeyboardButtonCallback extends InlineKeyboardButtonBase {
17
- /** Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */
18
15
  callbackData: string;
19
16
  }
20
17
  /** @unlisted */
21
18
  export interface InlineKeyboardButtonWebApp extends InlineKeyboardButtonBase {
22
- /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. */
23
19
  webApp: WebAppInfo;
24
20
  }
25
21
  /** @unlisted */
26
22
  export interface InlineKeyboardButtonLogin extends InlineKeyboardButtonBase {
27
- /** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login). */
28
23
  loginUrl: LoginUrl;
29
24
  }
30
25
  /** @unlisted */
31
26
  export interface InlineKeyboardButtonSwitchInline extends InlineKeyboardButtonBase {
32
- /** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. */
33
27
  switchInlineQuery: string;
34
28
  }
35
29
  /** @unlisted */
36
30
  export interface InlineKeyboardButtonSwitchInlineCurrent extends InlineKeyboardButtonBase {
37
- /** If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted. */
38
31
  switchInlineQueryCurrentChat: string;
39
32
  }
40
33
  /** @unlisted */
@@ -43,7 +36,6 @@ export interface InlineKeyboardButtonGame extends InlineKeyboardButtonBase {
43
36
  }
44
37
  /** @unlisted */
45
38
  export interface InlineKeyboardButtonPay extends InlineKeyboardButtonBase {
46
- /** Specify True to send a Pay button */
47
39
  pay: boolean;
48
40
  }
49
41
  /** This object represents one button of an inline keyboard. You **must** use exactly one of the optional fields. */
@@ -3,17 +3,11 @@ import { Location } from "./0_location.js";
3
3
  import { EntityGetter } from "./1__getters.js";
4
4
  import { User } from "./1_user.js";
5
5
  export interface InlineQuery {
6
- /** Unique identifier for this query */
7
6
  id: string;
8
- /** The user who made this query */
9
7
  from: User;
10
- /** The text of the query */
11
8
  query: string;
12
- /** Result offset */
13
9
  offset: string;
14
- /** Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */
15
10
  chatType?: "sender" | "private" | "group" | "supergroup" | "channel";
16
- /** The location of the user who made this query */
17
11
  location?: Location;
18
12
  }
19
13
  export declare function constructInlineQuery(query_: types.UpdateBotInlineQuery, getEntity: EntityGetter): Promise<InlineQuery>;
@@ -0,0 +1,8 @@
1
+ import { MessageReaction } from "./1_message_reaction.js";
2
+ export interface MessageInteractions {
3
+ chatId: number;
4
+ messageId: number;
5
+ reactions: MessageReaction[];
6
+ views: number;
7
+ forwards: number;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ChatP } from "./1_chat_p.js";
2
+ import { ReactionCount } from "./1_reaction_count.js";
3
+ export interface MessageReactionCount {
4
+ chat: ChatP;
5
+ messageId: number;
6
+ date: Date;
7
+ reactions: ReactionCount[];
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,18 +1,11 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { KeyboardButton } from "./1_keyboard_button.js";
3
- /** This object represents a custom keyboard with reply options. */
4
3
  export interface ReplyKeyboardMarkup {
5
- /** Array of button rows, each represented by an Array of `KeyboardButton` objects */
6
4
  keyboard: KeyboardButton[][];
7
- /** Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */
8
5
  isPersistent?: boolean;
9
- /** Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
10
6
  resizeKeyboard?: boolean;
11
- /** Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */
12
7
  oneTimeKeyboard?: boolean;
13
- /** The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
14
8
  inputFieldPlaceholder?: string;
15
- /** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the `Message` object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */
16
9
  selective?: boolean;
17
10
  }
18
11
  export declare function constructReplyKeyboardMarkup(keyboard_: types.ReplyKeyboardMarkup): ReplyKeyboardMarkup;
@@ -1,9 +1,7 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { UsernameResolver } from "./1__getters.js";
3
3
  import { InlineKeyboardButton } from "./2_inline_keyboard_button.js";
4
- /** This object represents an inline keyboard that appears right next to the message it belongs to. */
5
4
  export interface InlineKeyboardMarkup {
6
- /** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
7
5
  inlineKeyboard: InlineKeyboardButton[][];
8
6
  }
9
7
  export declare function constructInlineKeyboardMarkup(keyboard_: types.ReplyInlineMarkup): InlineKeyboardMarkup;
@@ -1,6 +1,5 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
2
  import { enums } from "../2_tl.js";
3
- import { Audio } from "./0_audio.js";
4
3
  import { Contact } from "./0_contact.js";
5
4
  import { Dice } from "./0_dice.js";
6
5
  import { ForceReply } from "./0_force_reply.js";
@@ -11,150 +10,331 @@ import { Venue } from "./0_venue.js";
11
10
  import { Voice } from "./0_voice.js";
12
11
  import { EntityGetter } from "./1__getters.js";
13
12
  import { Animation } from "./1_animation.js";
13
+ import { Audio } from "./1_audio.js";
14
14
  import { ChatP } from "./1_chat_p.js";
15
15
  import { Document } from "./1_document.js";
16
- import { ReplyQuote } from "./1_reply_quote.js";
16
+ import { Giveaway } from "./1_giveaway.js";
17
+ import { MessageReaction } from "./1_message_reaction.js";
17
18
  import { Photo } from "./1_photo.js";
18
19
  import { Poll } from "./1_poll.js";
20
+ import { ReplyQuote } from "./1_reply_quote.js";
19
21
  import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
20
22
  import { User } from "./1_user.js";
21
23
  import { VideoNote } from "./1_video_note.js";
22
24
  import { Video } from "./1_video.js";
23
- import { MessageReaction } from "./1_message_reaction.js";
24
- import { Giveaway } from "./1_giveaway.js";
25
25
  import { Game } from "./2_game.js";
26
26
  import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
27
27
  import { InlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
28
- /** Properties shared between all message types. */
28
+ /**
29
+ * Properties shared between all message types.
30
+ * @unlisted
31
+ */
29
32
  export interface MessageBase {
33
+ /** Whether the message is outgoing (sent by the current user). */
30
34
  out: boolean;
35
+ /** The identifier of the message. */
31
36
  id: number;
37
+ /** The identifier of the message's thread. */
32
38
  threadId?: number;
39
+ /** The user who sent the message. */
33
40
  from?: User;
41
+ /** The chat which the message was sent on behalf of. */
34
42
  senderChat?: ChatP;
43
+ /** The point of time in which the message was sent. */
35
44
  date: Date;
45
+ /** The chat where the message was sent to. */
36
46
  chat: ChatP;
47
+ /** A link to the message. */
37
48
  link?: string;
49
+ /** The original sender of the message. */
38
50
  forwardFrom?: User;
51
+ /** The original chat of the message. */
39
52
  forwardFromChat?: ChatP;
53
+ /** The original identifier of the message. */
40
54
  forwardId?: number;
55
+ /** The original signature of the message. */
41
56
  forwardSignature?: string;
57
+ /** The name of the original sender of the message. */
42
58
  forwardSenderName?: string;
59
+ /** The point of time in which the original message was sent. */
43
60
  forwardDate?: Date;
61
+ /** Whether the message was sent in a topic thread. */
44
62
  isTopicMessage: boolean;
63
+ /** Whether the message is an automatic forward. */
45
64
  isAutomaticForward?: boolean;
65
+ /** The message that is being replied to. Not always available even if a message is being replied to. */
46
66
  replyToMessage?: Message;
67
+ /** The identifier of the message that is being replied to. */
47
68
  replyToMessageId?: number;
69
+ /** The reactions of the message. */
48
70
  reactions?: MessageReaction[];
71
+ /** The part of the message that is being replied to. */
49
72
  replyQuote?: ReplyQuote;
73
+ /** The inline bot that was used to send this message. */
50
74
  viaBot?: User;
75
+ /** The point of time in which the message's last edit was made. */
51
76
  editDate?: Date;
77
+ /** Whether the contents of the message is protected. */
52
78
  hasProtectedContent?: boolean;
79
+ /** The identifier of the message's media group. */
53
80
  mediaGroupId?: string;
81
+ /** The signature of the message. */
54
82
  authorSignature?: string;
83
+ /** The number of times the message was viewed. */
55
84
  views?: number;
85
+ /** The number of times the message was forwarded. */
86
+ forwards?: number;
87
+ /** The message's reply markup. */
56
88
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
57
89
  }
58
- /** Properties shared between media message types. */
90
+ /**
91
+ * Properties shared between media message types.
92
+ * @unlisted
93
+ */
59
94
  export interface MessageMediaBase extends MessageBase {
60
95
  caption?: string;
61
96
  captionEntities?: MessageEntity[];
62
97
  hasMediaSpoiler?: boolean;
63
98
  }
99
+ /**
100
+ * A text message.
101
+ * @unlisted
102
+ */
64
103
  export interface MessageText extends MessageBase {
104
+ /** The text included in the message. */
65
105
  text: string;
106
+ /** Entities of the text. */
66
107
  entities: MessageEntity[];
67
108
  }
109
+ /** @unlisted */
68
110
  export interface MessagePhoto extends MessageMediaBase {
111
+ /** The photo included in the message. */
69
112
  photo: Photo;
70
113
  }
114
+ /**
115
+ * A document message.
116
+ * @unlisted
117
+ */
71
118
  export interface MessageDocument extends MessageMediaBase {
119
+ /** The document included in the message. */
72
120
  document: Document;
73
121
  }
122
+ /**
123
+ * A video message.
124
+ * @unlisted
125
+ */
74
126
  export interface MessageVideo extends MessageMediaBase {
127
+ /** The video included in the message. */
75
128
  video: Video;
76
129
  }
130
+ /**
131
+ * A sticker message.
132
+ * @unlisted
133
+ */
77
134
  export interface MessageSticker extends MessageBase {
135
+ /** The sticker included in the message. */
78
136
  sticker: Sticker;
79
137
  }
138
+ /**
139
+ * An animation message. Animations are GIFs or H.264/MPEG-4 AVC videos without sound.
140
+ * @unlisted
141
+ */
80
142
  export interface MessageAnimation extends MessageMediaBase {
143
+ /** The animation included in the message. */
81
144
  animation: Animation;
82
145
  }
146
+ /**
147
+ * A voice message.
148
+ * @unlisted
149
+ */
83
150
  export interface MessageVoice extends MessageMediaBase {
151
+ /** The voice included in the message. */
84
152
  voice: Voice;
85
153
  }
154
+ /**
155
+ * An audio message.
156
+ * @unlisted
157
+ */
86
158
  export interface MessageAudio extends MessageMediaBase {
159
+ /** The audio included in the message. */
87
160
  audio: Audio;
88
161
  }
162
+ /**
163
+ * A dice message.
164
+ * @unlisted
165
+ */
89
166
  export interface MessageDice extends MessageBase {
167
+ /** The dice included in the message. */
90
168
  dice: Dice;
91
169
  }
170
+ /**
171
+ * A video note message.
172
+ * @unlisted
173
+ */
92
174
  export interface MessageVideoNote extends MessageBase {
175
+ /** The video note included in the message. */
93
176
  videoNote: VideoNote;
94
177
  }
178
+ /**
179
+ * A contact message.
180
+ * @unlisted
181
+ */
95
182
  export interface MessageContact extends MessageBase {
183
+ /** The contact included in the message. */
96
184
  contact: Contact;
97
185
  }
186
+ /**
187
+ * A game message.
188
+ * @unlisted
189
+ */
98
190
  export interface MessageGame extends MessageBase {
191
+ /** The game included in the message. */
99
192
  game: Game;
100
193
  }
194
+ /**
195
+ * A poll message.
196
+ * @unlisted
197
+ */
101
198
  export interface MessagePoll extends MessageBase {
199
+ /** The poll included in the message. */
102
200
  poll: Poll;
103
201
  }
202
+ /**
203
+ * A venue message.
204
+ * @unlisted
205
+ */
104
206
  export interface MessageVenue extends MessageBase {
207
+ /** The venue included in the message. */
105
208
  venue: Venue;
106
209
  }
210
+ /**
211
+ * A location message.
212
+ * @unlisted
213
+ */
107
214
  export interface MessageLocation extends MessageBase {
215
+ /** The location included in the message. */
108
216
  location: Location;
109
217
  }
218
+ /**
219
+ * A message that is received when new members join a chat.
220
+ * @unlisted
221
+ */
110
222
  export interface MessageNewChatMembers extends MessageBase {
223
+ /** The new members of the chat. */
111
224
  newChatMembers: User[];
112
225
  }
226
+ /**
227
+ * A message that is received when a member leaves a chat.
228
+ * @unlisted
229
+ */
113
230
  export interface MessageLeftChatMember extends MessageBase {
231
+ /** The member who left the chat. */
114
232
  leftChatMember: User;
115
233
  }
234
+ /**
235
+ * A message that is received when a chat's title is changed.
236
+ * @unlisted
237
+ */
116
238
  export interface MessageNewChatTitle extends MessageBase {
239
+ /** The new title of the chat. */
117
240
  newChatTitle: string;
118
241
  }
242
+ /**
243
+ * A message that is received when a chat's photo is changed.
244
+ * @unlisted
245
+ */
119
246
  export interface MessageNewChatPhoto extends MessageBase {
247
+ /** The new photo of the chat. */
120
248
  newChatPhoto: Photo;
121
249
  }
250
+ /**
251
+ * A message that is received when a chat's photo is removed.
252
+ * @unlisted
253
+ */
122
254
  export interface MessageDeletedChatPhoto extends MessageBase {
123
255
  deletedChatPhoto: true;
124
256
  }
257
+ /**
258
+ * A message that is received by user accounts when a group is created.
259
+ * While bots don't receive them, they are able to see them if someone replies to them.
260
+ * @unlisted
261
+ */
125
262
  export interface MessageGroupCreated extends MessageBase {
126
263
  groupCreated: true;
264
+ /** The initial members of the group. */
127
265
  newChatMembers: User[];
128
266
  }
267
+ /**
268
+ * A message that is received by user accounts when a supergroup is created.
269
+ * While bots don't receive them, they are able to see them if someone replies to them.
270
+ * @unlisted
271
+ */
129
272
  export interface MessageSupergroupCreated extends MessageBase {
130
273
  supergroupCreated: true;
131
274
  }
275
+ /**
276
+ * A message that is received by user accounts when a channel is created.
277
+ * While bots don't receive them, they are able to see them if someone replies to them.
278
+ * @unlisted
279
+ */
132
280
  export interface MessageChannelCreated extends MessageBase {
133
281
  channelCreated: true;
134
282
  }
283
+ /**
284
+ * A message that is received when a chat's auto-delete timer is changed.
285
+ * @unlisted
286
+ */
135
287
  export interface MessageAutoDeleteTimerChanged extends MessageBase {
288
+ /** The new auto-delete time in seconds. */
136
289
  newAutoDeleteTime: number;
137
290
  }
291
+ /**
292
+ * A message that is received when a supergroup is created as a result of a group migration.
293
+ * @unlisted
294
+ */
138
295
  export interface MessageChatMigratedTo extends MessageBase {
296
+ /** The supergroup's ID. */
139
297
  chatMigratedTo: number;
140
298
  }
299
+ /**
300
+ * A message that is received when a group is migrated to a supergroup.
301
+ * @unlisted
302
+ */
141
303
  export interface MessageChatMigratedFrom extends MessageBase {
304
+ /** The group's ID. */
142
305
  chatMigratedFrom: number;
143
306
  }
307
+ /**
308
+ * A message that is received when a message is pinned in a chat.
309
+ * @unlisted
310
+ */
144
311
  export interface MessagePinnedMessage extends MessageBase {
312
+ /** The message that was pinned. */
145
313
  pinnedMessage: Message;
146
314
  }
315
+ /**
316
+ * A message that is received when a bot account receives a shared user.
317
+ * @unlisted
318
+ */
147
319
  export interface MessageUserShared extends MessageBase {
148
320
  userShared: {
149
321
  requestId: number;
150
322
  userId: number;
151
323
  };
152
324
  }
325
+ /**
326
+ * A message that is received when a bot is allowed to message a user.
327
+ * @unlisted
328
+ */
153
329
  export interface MessageWriteAccessAllowed extends MessageBase {
154
330
  writeAccessAllowed: {
155
331
  webAppName?: string;
156
332
  };
157
333
  }
334
+ /**
335
+ * A message that is received when a new topic is created in a forum.
336
+ * @unlisted
337
+ */
158
338
  export interface MessageForumTopicCreated extends MessageBase {
159
339
  forumTopicCreated: {
160
340
  name: string;
@@ -162,34 +342,70 @@ export interface MessageForumTopicCreated extends MessageBase {
162
342
  iconCutsomEmojiId?: string;
163
343
  };
164
344
  }
345
+ /**
346
+ * A message that is received when a topic is edited in a forum.
347
+ * @unlisted
348
+ */
165
349
  export interface MessageForumTopicEdited extends MessageBase {
166
350
  forumTopicEdited: {
167
351
  name: string;
168
352
  iconCutsomEmojiId?: string;
169
353
  };
170
354
  }
355
+ /**
356
+ * A message that is received when a topic is closed in a forum.
357
+ * @unlisted
358
+ */
171
359
  export interface MessageForumTopicClosed extends MessageBase {
172
360
  forumTopicClosed: true;
173
361
  }
362
+ /**
363
+ * A message that is received when a topic is reopened in a forum.
364
+ * @unlisted
365
+ */
174
366
  export interface MessageForumTopicReopened extends MessageBase {
175
367
  forumTopicReopened: true;
176
368
  }
369
+ /**
370
+ * A message that is received when a video chat is scheduled in a chat.
371
+ * @unlisted
372
+ */
177
373
  export interface MessageVideoChatScheduled extends MessageBase {
178
374
  videoChatScheduled: {
179
375
  startDate: Date;
180
376
  };
181
377
  }
378
+ /**
379
+ * A message that is received when a video chat is started in a chat.
380
+ * @unlisted
381
+ */
182
382
  export interface MessageVideoChatStarted extends MessageBase {
183
383
  videoChatStarted: true;
184
384
  }
385
+ /**
386
+ * A message that is received when a video chat is ended in a chat.
387
+ * @unlisted
388
+ */
185
389
  export interface MessageVideoChatEnded extends MessageBase {
186
390
  videoChatEnded: {
187
391
  duration: number;
188
392
  };
189
393
  }
394
+ /**
395
+ * A message that is received when a giveaway is started in a chat.
396
+ * @unlisted
397
+ */
190
398
  export interface MessageGiveaway extends MessageBase {
191
399
  giveaway: Giveaway;
192
400
  }
401
+ /**
402
+ * An unsupported message.
403
+ * @unlisted
404
+ */
405
+ export interface MessageUnsupported extends MessageBase {
406
+ unsupported: true;
407
+ }
408
+ /** @unlisted */
193
409
  export interface MessageTypes {
194
410
  text: MessageText;
195
411
  photo: MessagePhoto;
@@ -228,9 +444,11 @@ export interface MessageTypes {
228
444
  videoChatStarted: MessageVideoChatStarted;
229
445
  videoChatEnded: MessageVideoChatEnded;
230
446
  giveaway: MessageGiveaway;
447
+ unsupported: MessageUnsupported;
231
448
  }
232
449
  export declare function assertMessageType<T extends keyof MessageTypes>(message: Message, type: T): MessageTypes[T];
233
- export type Message = MessageText | MessagePhoto | MessageDocument | MessageVideo | MessageSticker | MessageAnimation | MessageVoice | MessageAudio | MessageDice | MessageVideoNote | MessageContact | MessageGame | MessagePoll | MessageVenue | MessageLocation | MessageNewChatMembers | MessageLeftChatMember | MessageNewChatTitle | MessageNewChatPhoto | MessageDeletedChatPhoto | MessageGroupCreated | MessageSupergroupCreated | MessageChannelCreated | MessageAutoDeleteTimerChanged | MessageChatMigratedTo | MessageChatMigratedFrom | MessagePinnedMessage | MessageUserShared | MessageWriteAccessAllowed | MessageForumTopicCreated | MessageForumTopicEdited | MessageForumTopicClosed | MessageForumTopicReopened | MessageVideoChatScheduled | MessageVideoChatStarted | MessageVideoChatEnded | MessageGiveaway;
450
+ export type Message = MessageText | MessagePhoto | MessageDocument | MessageVideo | MessageSticker | MessageAnimation | MessageVoice | MessageAudio | MessageDice | MessageVideoNote | MessageContact | MessageGame | MessagePoll | MessageVenue | MessageLocation | MessageNewChatMembers | MessageLeftChatMember | MessageNewChatTitle | MessageNewChatPhoto | MessageDeletedChatPhoto | MessageGroupCreated | MessageSupergroupCreated | MessageChannelCreated | MessageAutoDeleteTimerChanged | MessageChatMigratedTo | MessageChatMigratedFrom | MessagePinnedMessage | MessageUserShared | MessageWriteAccessAllowed | MessageForumTopicCreated | MessageForumTopicEdited | MessageForumTopicClosed | MessageForumTopicReopened | MessageVideoChatScheduled | MessageVideoChatStarted | MessageVideoChatEnded | MessageGiveaway | MessageUnsupported;
451
+ /** @unlisted */
234
452
  export interface MessageGetter {
235
453
  (chatId: number, messageId: number): MaybePromise<Message | null>;
236
454
  }
@@ -2,7 +2,6 @@ import { debug } from "../0_deps.js";
2
2
  import { cleanObject, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
3
3
  import { as, types } from "../2_tl.js";
4
4
  import { FileID, FileType, FileUniqueID, FileUniqueType } from "./0__file_id.js";
5
- import { constructAudio } from "./0_audio.js";
6
5
  import { constructContact } from "./0_contact.js";
7
6
  import { constructDice } from "./0_dice.js";
8
7
  import { constructForceReply } from "./0_force_reply.js";
@@ -12,17 +11,18 @@ import { constructReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
12
11
  import { constructVenue } from "./0_venue.js";
13
12
  import { constructVoice } from "./0_voice.js";
14
13
  import { constructAnimation } from "./1_animation.js";
14
+ import { constructAudio } from "./1_audio.js";
15
15
  import { constructChatP } from "./1_chat_p.js";
16
16
  import { constructDocument } from "./1_document.js";
17
- import { constructReplyQuote } from "./1_reply_quote.js";
17
+ import { constructGiveaway } from "./1_giveaway.js";
18
+ import { constructMessageReaction } from "./1_message_reaction.js";
18
19
  import { constructPhoto } from "./1_photo.js";
19
20
  import { constructPoll } from "./1_poll.js";
21
+ import { constructReplyQuote } from "./1_reply_quote.js";
20
22
  import { constructSticker } from "./1_sticker.js";
21
23
  import { constructUser } from "./1_user.js";
22
24
  import { constructVideoNote } from "./1_video_note.js";
23
25
  import { constructVideo } from "./1_video.js";
24
- import { constructMessageReaction } from "./1_message_reaction.js";
25
- import { constructGiveaway } from "./1_giveaway.js";
26
26
  import { constructGame } from "./2_game.js";
27
27
  import { constructReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
28
28
  import { constructInlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
@@ -65,6 +65,7 @@ const keys = {
65
65
  videoChatStarted: ["videoChatStarted"],
66
66
  videoChatEnded: ["videoChatEnded"],
67
67
  giveaway: ["giveaway"],
68
+ unsupported: ["unsupported"],
68
69
  };
69
70
  export function assertMessageType(message, type) {
70
71
  for (const key of keys[type]) {
@@ -140,9 +141,6 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
140
141
  const leftChatMember = user;
141
142
  return { ...message, leftChatMember };
142
143
  }
143
- else {
144
- UNREACHABLE();
145
- }
146
144
  }
147
145
  else if (message_.action instanceof types.MessageActionChatEditTitle) {
148
146
  const newChatTitle = message_.action.title;
@@ -165,9 +163,6 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
165
163
  const user = constructUser(entity);
166
164
  newChatMembers.push(user);
167
165
  }
168
- else {
169
- UNREACHABLE();
170
- }
171
166
  }
172
167
  return { ...message, groupCreated, newChatMembers };
173
168
  }
@@ -181,7 +176,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
181
176
  return { ...message, supergroupCreated };
182
177
  }
183
178
  else {
184
- UNREACHABLE();
179
+ // UNREACHABLE();
185
180
  }
186
181
  }
187
182
  else if (message_.action instanceof types.MessageActionChatMigrateTo) {
@@ -194,11 +189,10 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
194
189
  }
195
190
  else if (message_.action instanceof types.MessageActionPinMessage) {
196
191
  const { replyToMessage } = await getReply(message_, chat, getMessage);
197
- if (!replyToMessage) {
198
- UNREACHABLE();
192
+ if (replyToMessage) {
193
+ const pinnedMessage = replyToMessage;
194
+ return { ...message, pinnedMessage };
199
195
  }
200
- const pinnedMessage = replyToMessage;
201
- return { ...message, pinnedMessage };
202
196
  }
203
197
  else if (message_.action instanceof types.MessageActionRequestedPeer) {
204
198
  const user = message_.action.peers[0][as](types.PeerUser);
@@ -253,9 +247,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
253
247
  const newAutoDeleteTime = message_.action.period || 0;
254
248
  return { ...message, newAutoDeleteTime };
255
249
  }
256
- else {
257
- UNREACHABLE();
258
- }
250
+ return { ...message, unsupported: true };
259
251
  }
260
252
  export async function constructMessage(message_, getEntity, getMessage, getStickerSetName, getReply_ = true) {
261
253
  if (!(message_ instanceof types.Message) && !(message_ instanceof types.MessageService)) {
@@ -304,6 +296,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
304
296
  link,
305
297
  date: new Date(message_.date * 1000),
306
298
  views: message_.views,
299
+ forwards: message_.forwards,
307
300
  isTopicMessage: false,
308
301
  hasProtectedContent: message_.noforwards || false,
309
302
  };
@@ -481,18 +474,15 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
481
474
  m = { ...message, location };
482
475
  }
483
476
  else if (message_.media instanceof types.MessageMediaWebPage) {
484
- UNREACHABLE(); // TODO: implement
477
+ // TODO: implement
485
478
  }
486
479
  else if (message_.media instanceof types.MessageMediaGiveaway) {
487
480
  const giveaway = constructGiveaway(message_.media);
488
481
  m = { ...message, giveaway };
489
482
  }
490
- else {
491
- // not implemented
492
- UNREACHABLE();
493
- }
494
483
  if (m == null) {
495
- UNREACHABLE();
484
+ const unsupported = true;
485
+ m = { ...message, unsupported };
496
486
  }
497
487
  return cleanObject(m);
498
488
  }
@@ -1,7 +1,7 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { EntityGetter } from "./1__getters.js";
3
3
  import { User } from "./1_user.js";
4
- import { Message, MessageGetter } from "./3_message.js";
4
+ import { Message, MessageGetter } from "./4_message.js";
5
5
  export interface CallbackQuery {
6
6
  id: string;
7
7
  from: User;