@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
@@ -1,54 +1,33 @@
1
- import { FileSource } from "./0_utilities.js";
2
1
  import { MaybePromise } from "../1_utilities.js";
3
- import { functions, types } from "../2_tl.js";
4
- import { BotCommandScope, CallbackQuery, Chat, ChatID, ChosenInlineResult, ForceReply, InlineKeyboardMarkup, InlineQuery, InlineQueryResultButton, Message, MessageEntity, MessageReaction, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyQuote } from "../3_types.js";
5
- import { ClientPlainParams } from "./2_client_plain.js";
2
+ import { BotCommandScope, Chat, ChatID, ForceReply, InlineKeyboardMarkup, InlineQueryResultButton, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyQuote } from "../3_types.js";
6
3
  import { ParseMode } from "../3_types.js";
4
+ import { FileSource } from "./0_utilities.js";
5
+ import { ClientPlainParams } from "./2_client_plain.js";
7
6
  export interface ClientParams extends ClientPlainParams {
8
- /**
9
- * A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`.
10
- */
7
+ /** A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`. */
11
8
  parseMode?: ParseMode;
12
- /**
13
- * The app_version parameter to be passed to initConnection when calling `authorize`. It is recommended that this parameter is changed if users are authorized. Defaults to "MTKruto" followed by this version of MTKruto.
14
- */
9
+ /** The app_version parameter to be passed to initConnection when calling `authorize`. It is recommended that this parameter is changed if users are authorized. Defaults to "MTKruto" followed by this version of MTKruto. */
15
10
  appVersion?: string;
16
- /**
17
- * The device_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
18
- */
11
+ /** The device_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime. */
19
12
  deviceModel?: string;
20
- /**
21
- * The lang_code parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
22
- */
13
+ /** The lang_code parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`. */
23
14
  langCode?: string;
24
- /**
25
- * The lang_pack parameter to be passed to initConnection when calling `authorize`. Defaults to an empty string.
26
- */
15
+ /** The lang_pack parameter to be passed to initConnection when calling `authorize`. Defaults to an empty string. */
27
16
  langPack?: string;
28
- /**
29
- * The system_lang_cde parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
30
- */
17
+ /** The system_lang_cde parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`. */
31
18
  systemLangCode?: string;
32
- /**
33
- * The system_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
34
- */
19
+ /** The system_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime. */
35
20
  systemVersion?: string;
36
- /**
37
- * Whether to automatically call `start` with no parameters in the first `invoke` call. Defaults to `true`.
38
- */
21
+ /** Whether to automatically call `start` with no parameters in the first `invoke` call. Defaults to `true`. */
39
22
  autoStart?: boolean;
40
- /**
41
- * Whether to use default handlers. Defaults to `true`.
42
- */
23
+ /** Whether to use default handlers. Defaults to `true`. */
43
24
  defaultHandlers?: boolean;
44
- /**
45
- * Whether to ignore outgoing messages. Defaults to `true` for bots, and `false` for users.
46
- */
25
+ /** Whether to ignore outgoing messages. Defaults to `true` for bots, and `false` for users. */
47
26
  ignoreOutgoing?: boolean;
48
- /**
49
- * Default command prefixes. Defaults to `"/"` for bots and `"\"` for users. This option must be set separately for nested composers.
50
- */
27
+ /** Default command prefixes. Defaults to `"/"` for bots and `"\"` for users. This option must be set separately for nested composers. */
51
28
  prefixes?: string | string[];
29
+ /** Whether to guarantee that order-sensitive updates are delivered at least once before delivering next ones. Useful mainly for clients providing a user interface à la Telegram Desktop. Defaults to `false`. */
30
+ guaranteeUpdateDelivery?: boolean;
52
31
  }
53
32
  export interface AnswerCallbackQueryParams {
54
33
  /** A text to be shown to the user. */
@@ -66,117 +45,65 @@ export interface AuthorizeUserParams<S = string> {
66
45
  password: S | ((hint: string | null) => MaybePromise<S>);
67
46
  }
68
47
  export interface _SendCommon {
69
- /**
70
- * Whether to send the message in a silent way without making a sound on the recipients' clients.
71
- */
48
+ /** Whether to send the message in a silent way without making a sound on the recipients' clients. */
72
49
  disableNotification?: boolean;
73
- /**
74
- * Whether to protect the contents of the message from copying and forwarding.
75
- */
50
+ /** Whether to protect the contents of the message from copying and forwarding. */
76
51
  protectContent?: boolean;
77
- /**
78
- * The identifier of a message to reply to.
79
- */
52
+ /** The identifier of a message to reply to. */
80
53
  replyToMessageId?: number;
81
- /**
82
- * A specific part of the replying message's text to quote.
83
- */
54
+ /** A specific part of the replying message's text to quote. */
84
55
  replyQuote?: ReplyQuote;
85
- /**
86
- * The identifier of a thread to send the message to.
87
- */
56
+ /** The identifier of a thread to send the message to. */
88
57
  messageThreadId?: number;
89
- /**
90
- * The identifier of the chat to send the message on behalf of. User-only.
91
- */
58
+ /** The identifier of the chat to send the message on behalf of. User-only. */
92
59
  sendAs?: ChatID;
93
- /**
94
- * The reply markup of the message. Bot-only.
95
- */
60
+ /** The reply markup of the message. Bot-only. */
96
61
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
97
62
  }
98
63
  export interface SendMessageParams extends _SendCommon {
99
- /**
100
- * The parse mode to use. If not provided, the default parse mode will be used.
101
- */
64
+ /** The parse mode to use. If not provided, the default parse mode will be used. */
102
65
  parseMode?: ParseMode;
103
- /**
104
- * The message's entities.
105
- */
66
+ /** The message's entities. */
106
67
  entities?: MessageEntity[];
107
- /**
108
- * Whether to disable web page previews in the message that is to be sent.
109
- */
68
+ /** Whether to disable web page previews in the message that is to be sent. */
110
69
  disableWebPagePreview?: boolean;
111
70
  }
112
71
  export interface EditMessageParams {
113
- /**
114
- * The parse mode to use. If not provided, the default parse mode will be used.
115
- */
72
+ /** The parse mode to use. If not provided, the default parse mode will be used. */
116
73
  parseMode?: ParseMode;
117
- /**
118
- * The message's entities.
119
- */
74
+ /** The message's entities. */
120
75
  entities?: MessageEntity[];
121
- /**
122
- * Whether to disable web page previews in the message that is to be edited.
123
- */
76
+ /** Whether to disable web page previews in the message that is to be edited. */
124
77
  disableWebPagePreview?: boolean;
125
- /**
126
- * The reply markup of the message. Bot-only.
127
- */
78
+ /** The reply markup of the message. Bot-only. */
128
79
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
129
80
  }
130
81
  export interface ForwardMessagesParams extends Omit<_SendCommon, "replyToMessageId" | "replyMarkup"> {
131
- /**
132
- * Whether to not include the original sender of the message that is going to be forwarded.
133
- */
82
+ /** Whether to not include the original sender of the message that is going to be forwarded. */
134
83
  dropSenderName?: boolean;
135
- /**
136
- * Whether to not include the original caption of the message that is going to be forwarded.
137
- */
84
+ /** Whether to not include the original caption of the message that is going to be forwarded. */
138
85
  dropCaption?: boolean;
139
86
  }
140
87
  export interface SendPollParams extends _SendCommon {
141
- /**
142
- * Whether the poll should be anonymous.
143
- */
88
+ /** Whether the poll should be anonymous. */
144
89
  isAnonymous?: boolean;
145
- /**
146
- * The type of the poll.
147
- */
90
+ /** The type of the poll. */
148
91
  type?: "quiz" | "regular";
149
- /**
150
- * Whether multiple selections should be allowed. Only valid for regular polls.
151
- */
92
+ /** Whether multiple selections should be allowed. Only valid for regular polls. */
152
93
  allowMultipleAnswers?: boolean;
153
- /**
154
- * Index of the correct option. Required for quiz polls.
155
- */
94
+ /** Index of the correct option. Required for quiz polls. */
156
95
  correctOptionIndex?: number;
157
- /**
158
- * A text that will be shown to the user when the poll is answered. Only valid for quiz polls.
159
- */
96
+ /** A text that will be shown to the user when the poll is answered. Only valid for quiz polls. */
160
97
  explanation?: string;
161
- /**
162
- * The parse mode to use for the explanation. If not provided, the default parse mode will be used.
163
- */
98
+ /** The parse mode to use for the explanation. If not provided, the default parse mode will be used. */
164
99
  explanationParseMode?: ParseMode;
165
- /**
166
- * The explanation's entities.
167
- */
100
+ /** The explanation's entities. */
168
101
  explanationEntities?: MessageEntity[];
169
- /**
170
- * Duration of the poll in seconds. Must be in the range of 5-600. Cannot be used simultaneously with `closeDate`.
171
- */
102
+ /** Duration of the poll in seconds. Must be in the range of 5-600. Cannot be used simultaneously with `closeDate`. */
172
103
  openPeriod?: number;
173
- /**
174
- * The time in which the poll will be closed. Must be at least 5 seconds in the future, and no more than 600. Cannot be used simultaneously with `openPeriod`.
175
- */
104
+ /** The time in which the poll will be closed. Must be at least 5 seconds in the future, and no more than 600. Cannot be used simultaneously with `openPeriod`. */
176
105
  closeDate?: Date;
177
- /**
178
- * Whether the poll should be closed as soon as it is sent, allowing no answers.
179
- */
106
+ /** Whether the poll should be closed as soon as it is sent, allowing no answers. */
180
107
  isClosed?: boolean;
181
108
  }
182
109
  export interface DownloadParams {
@@ -202,14 +129,20 @@ export interface UploadParams {
202
129
  signal?: AbortSignal | null;
203
130
  }
204
131
  export interface AnswerInlineQueryParams {
132
+ /** TTL of the caches of the results in seconds. Defaults to 300. */
205
133
  cacheTime?: number;
134
+ /** Whether the result caches should only be for the user who made the inline query. */
206
135
  isPersonal?: boolean;
136
+ /** A parameter to be passed to the same query next time when the user’s client asks for more results. Can’t be longer than 64 bytes. */
207
137
  nextOffset?: string;
208
138
  isGallery?: boolean;
139
+ /** A button to be shown along with the results. */
209
140
  button?: InlineQueryResultButton;
210
141
  }
211
142
  export interface SetMyCommandsParams {
143
+ /** A two-letter ISO 639-1 language code. If not set, the command details will be updated for users having an unsupported language. */
212
144
  languageCode?: string;
145
+ /** The scope in which the commands are available. */
213
146
  scope?: BotCommandScope;
214
147
  }
215
148
  export type GetMyCommandsParams = SetMyCommandsParams;
@@ -224,19 +157,13 @@ export interface DeleteMessageParams {
224
157
  export interface _CaptionCommon {
225
158
  /** The caption to attach. */
226
159
  caption?: string;
227
- /**
228
- * The caption's entities.
229
- */
160
+ /** The caption's entities. */
230
161
  captionEntities?: MessageEntity[];
231
- /**
232
- * The parse mode to use for the caption. If not provided, the default parse mode will be used.
233
- */
162
+ /** The parse mode to use for the caption. If not provided, the default parse mode will be used. */
234
163
  parseMode?: ParseMode;
235
164
  }
236
165
  export interface _SpoilCommon {
237
- /**
238
- * Whether to mark the media as a spoiler.
239
- */
166
+ /** Whether to mark the media as a spoiler. */
240
167
  hasSpoiler?: boolean;
241
168
  }
242
169
  export interface SendPhotoParams extends _CaptionCommon, _SpoilCommon, _UploadCommon, _SendCommon {
@@ -254,12 +181,15 @@ export interface SendVideoParams extends _CaptionCommon, _ThumbnailCommon, _Spoi
254
181
  width?: number;
255
182
  /** The height of the photo in pixels. */
256
183
  height?: number;
184
+ /** Whether the video is suitable for streaming. */
257
185
  supportsStreaming?: boolean;
258
186
  }
259
187
  export interface SendAnimationParams extends _CaptionCommon, _ThumbnailCommon, _SpoilCommon, _UploadCommon, _SendCommon {
260
188
  /** The duration of the animation in seconds. */
261
189
  duration?: number;
190
+ /** The width of the animation file. */
262
191
  width?: number;
192
+ /** The height of the animation file. */
263
193
  height?: number;
264
194
  }
265
195
  export interface SendVoiceParams extends _CaptionCommon, _ThumbnailCommon, _UploadCommon, _SendCommon {
@@ -269,23 +199,33 @@ export interface SendVoiceParams extends _CaptionCommon, _ThumbnailCommon, _Uplo
269
199
  export interface SendAudioParams extends _CaptionCommon, _ThumbnailCommon, _UploadCommon, _SendCommon {
270
200
  /** The duration of the audio file in seconds. */
271
201
  duration?: number;
202
+ /** Names of the entities that are being featured in the audio. */
272
203
  performer?: string;
204
+ /** The title of the audio. */
273
205
  title?: string;
274
206
  }
275
207
  export interface SendVideoNoteParams extends _CaptionCommon, _ThumbnailCommon, _UploadCommon, _SendCommon {
276
208
  /** The duration of the video note in seconds. */
277
209
  duration?: number;
210
+ /** The video's width and height (diameter). */
278
211
  length?: number;
212
+ /** A thumbnail of the file to attach. Can't be larger than 200kB or have a height exceeding 320 pixels. Can't reuse an existing file for it and can only be uploaded directly. */
279
213
  thumbnail?: FileSource;
280
214
  }
281
215
  export interface SendLocationParams extends _SendCommon {
216
+ /** The accuracy radius of the location in meters. Must be in the range of 0-1500. */
282
217
  horizontalAccuracy?: number;
218
+ /** The duration in which the location can be updated in seconds. Must be in the range of 80-864,000. */
283
219
  livePeriod?: number;
220
+ /** The direction which the user is moving towards. Must be in the range of 1-350. */
284
221
  heading?: number;
222
+ /** The maximum distance for proximity alerts on approaching another chat member in meters. Must be in the range 1-100,000. */
285
223
  proximityAlertRadius?: number;
286
224
  }
287
225
  export interface SendVenueParams extends _SendCommon {
226
+ /** Foursquare identifier of the venue. */
288
227
  foursquareId?: string;
228
+ /** Foursquare type of the venue, if known. For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream". */
289
229
  foursquareType?: string;
290
230
  }
291
231
  export interface SendContactParams extends _SendCommon {
@@ -295,12 +235,9 @@ export interface SendContactParams extends _SendCommon {
295
235
  vcard?: string;
296
236
  }
297
237
  export interface SendDiceParams extends _SendCommon {
238
+ /** The type of the dice. Can be 🎲, 🎯, 🏀, ⚽, 🎳, 🎰. Defaults to 🎲. */
298
239
  emoji?: "🎲" | "🎯" | "🏀" | "⚽" | "🎳" | "🎰";
299
240
  }
300
- export type ConnectionState = "notConnected" | "updating" | "ready";
301
- export type AuthorizationState = {
302
- authorized: boolean;
303
- };
304
241
  export interface ReplyParams {
305
242
  /** Whether to quote the message that is to be replied. Enabled by default for non-private chats. */
306
243
  quote?: boolean;
@@ -311,58 +248,13 @@ export interface GetHistoryParams {
311
248
  /** The maximum number of results to return. Must be in the range of 1-100. Defaults to 100. */
312
249
  limit?: number;
313
250
  }
251
+ export interface SetReactionsParams {
252
+ big?: boolean;
253
+ }
314
254
  export interface AddReactionParams {
315
255
  big?: boolean;
316
256
  addToRecents?: boolean;
317
257
  }
318
- export type MessageUpdates = "message" | "editedMessage";
319
- export interface Update {
320
- message?: Message;
321
- editedMessage?: Message;
322
- connectionState?: ConnectionState;
323
- authorizationState?: AuthorizationState;
324
- deletedMessages?: [Message, ...Message[]];
325
- callbackQuery?: CallbackQuery;
326
- inlineQuery?: InlineQuery;
327
- chosenInlineResult?: ChosenInlineResult;
328
- newChat?: Chat;
329
- editedChat?: Chat;
330
- deletedChat?: {
331
- chatId: number;
332
- };
333
- reactions?: {
334
- chatId: number;
335
- messageId: number;
336
- reactions: MessageReaction[];
337
- };
338
- }
339
- export type NextFn<T = void> = () => Promise<T>;
340
- export interface Handler<C> {
341
- (ctx: C, next: NextFn): MaybePromise<void>;
342
- }
343
- export interface InvokeErrorHandler<C> {
344
- (ctx: {
345
- client: C;
346
- error: unknown;
347
- function: types.Type | functions.Function<unknown>;
348
- n: number;
349
- }, next: NextFn<boolean>): MaybePromise<boolean>;
350
- }
351
- type Update_ = Update;
352
- export type FilterUpdate<U extends Update_, Type extends keyof Update_, Field extends string, TypeType = NonNullable<Update_[Type]>> = Omit<U, keyof Update_> & Omit<Update_, Type> & {
353
- [Type_ in Type]-?: Field extends keyof TypeType ? TypeType & {
354
- [Field_ in Field]-?: Field extends keyof TypeType ? NonNullable<TypeType[Field]> : never;
355
- } : NonNullable<TypeType>;
356
- };
357
- export interface NetworkStatisticsEntry {
358
- sent: number;
359
- received: number;
360
- }
361
- export interface NetworkStatistics {
362
- messages: NetworkStatisticsEntry;
363
- cdn: NetworkStatisticsEntry;
364
- }
365
- export declare function getChatListId(chatList: string): 0 | 1;
366
258
  export interface GetChatsParams {
367
259
  /** The chat list to get the chats from. Defaults to main. */
368
260
  from?: "main" | "archived";
@@ -371,4 +263,3 @@ export interface GetChatsParams {
371
263
  /** The maximum number of results to return. Must be in the range of 1-100. Defaults to 100. */
372
264
  limit?: number;
373
265
  }
374
- export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,12 +2,21 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, ReadObject, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
- import { BotCommand, CallbackQuery, Chat, ChatAction, ChatID, Document, InlineQuery, InlineQueryResult, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageTypes, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, ParseMode, Reaction, User } from "../3_types.js";
5
+ import { BotCommand, Chat, ChatAction, ChatID, ChatP, Document, InlineQueryResult, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageTypes, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Reaction, Update, UpdateIntersection, UpdateMap, User } from "../3_types.js";
6
6
  import { Migrate } from "../4_errors.js";
7
- import { FileSource, With } from "./0_utilities.js";
8
- import { ClientAbstract } from "./1_client_abstract.js";
9
- import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, FilterUpdate, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, InvokeErrorHandler, MessageUpdates, NetworkStatistics, ReplyParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
- import { Composer, Middleware } from "./4_composer.js";
7
+ import { ClientAbstract } from "./0_client_abstract.js";
8
+ import { FileSource, WithUpdate } from "./0_utilities.js";
9
+ import { Composer, Middleware } from "./1_composer.js";
10
+ import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DeleteMessageParams, DeleteMessagesParams, DownloadParams, EditMessageParams, ForwardMessagesParams, GetChatsParams, GetHistoryParams, GetMyCommandsParams, ReplyParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetMyCommandsParams, SetReactionsParams, UploadParams } from "./3_params.js";
11
+ export type NextFn<T = void> = () => Promise<T>;
12
+ export interface InvokeErrorHandler<C> {
13
+ (ctx: {
14
+ client: C;
15
+ error: unknown;
16
+ function: types.Type | functions.Function<unknown>;
17
+ n: number;
18
+ }, next: NextFn<boolean>): MaybePromise<boolean>;
19
+ }
11
20
  declare const getEntity: unique symbol;
12
21
  declare const getStickerSetName: unique symbol;
13
22
  export declare const handleMigrationError: unique symbol;
@@ -25,18 +34,19 @@ export type Api = {
25
34
  } ? Promisify<Functions[K][K_]["__F"]> : Functions[K][K_];
26
35
  };
27
36
  };
28
- export interface Context extends Update {
37
+ export interface Context {
29
38
  /** The client that received the update. */
30
39
  client: Client;
31
- me: undefined extends this["connectionState"] ? undefined extends this["authorizationState"] ? User : (User | undefined) : (User | undefined);
32
- /** Resolves to `ctx.message ?? ctx.editedMessage ?? ctx.callbackQuery?.message`. */
33
- msg: undefined extends this["message"] ? undefined extends this["editedMessage"] ? undefined extends this["callbackQuery"] ? never : this["callbackQuery"] extends With<CallbackQuery, "message"> ? this["callbackQuery"]["message"] : this["callbackQuery"] extends With<CallbackQuery, "inlineMessageId"> ? never : (Message | undefined) : this["editedMessage"] : this["message"];
34
- /** Resolves to `effectiveMessage?.chat`. */
35
- chat: this["msg"] extends never ? never : this["msg"]["chat"];
36
- /** Resolves to `(ctx.message ?? ctx.editedMessage)?.from ?? ctx.callbackQuery?.from ?? ctx.inlineQuery?.from`. */
37
- from: this["message"] extends Message ? this["message"]["from"] : this["editedMessage"] extends Message ? this["editedMessage"]["from"] : this["callbackQuery"] extends CallbackQuery ? this["callbackQuery"]["from"] : this["inlineQuery"] extends InlineQuery ? this["inlineQuery"]["from"] : never;
38
- /** Resolves to `effectiveMessage?.senderChat`. */
39
- senderChat: this["msg"] extends never ? never : this["msg"]["senderChat"];
40
+ /** The currently authorized user. */
41
+ me?: User;
42
+ /** Resolves to `message`, `editedMessage`, or the `message` field of `callbackQuery`. */
43
+ msg?: Message;
44
+ /** Resolves to `msg?.chat`. TODO */
45
+ chat?: ChatP;
46
+ /** Resolves to the `from` field of `message`, `editedMessage`, `callbackQuery`, or `inlineQuery`. */
47
+ from?: User;
48
+ /** Resolves to `msg?.senderChat`. */
49
+ senderChat?: ChatP;
40
50
  /** Reply the received message with a text message. */
41
51
  reply: (text: string, params?: Omit<SendMessageParams, "replyToMessageId"> & ReplyParams) => Promise<MessageText>;
42
52
  /** Reply the received message with a poll. */
@@ -67,6 +77,8 @@ export interface Context extends Update {
67
77
  delete: () => Promise<void>;
68
78
  /** Forward the received message. */
69
79
  forward: (to: ChatID, params?: ForwardMessagesParams) => Promise<this["msg"]>;
80
+ /** Change the reactions made to the received message. */
81
+ react: (reactions: Reaction[], params?: SetReactionsParams) => Promise<void>;
70
82
  /** Send a chat action to the chat which the message was received from. */
71
83
  sendChatAction: (action: ChatAction, params?: {
72
84
  messageThreadId?: number;
@@ -93,6 +105,10 @@ export interface Context extends Update {
93
105
  setAvailableReactions: (availableReactions: "none" | "all" | Reaction[]) => Promise<void>;
94
106
  /** Add a reaction to a message of the chat which the message was received from. */
95
107
  addReaction: (messageId: number, reaction: Reaction, params?: AddReactionParams) => Promise<void>;
108
+ /** Remove a reaction from a message of the chat which the message was received from. */
109
+ removeReaction: (messageId: number, reaction: Reaction) => Promise<void>;
110
+ /** Change the reactions made to a message of the chat which the message was received from. */
111
+ setReactions: (messageId: number, reactions: Reaction[], params?: SetReactionsParams) => Promise<void>;
96
112
  toJSON: () => Update;
97
113
  }
98
114
  export declare function skipInvoke<C extends Context>(): InvokeErrorHandler<Client<C>>;
@@ -319,21 +335,21 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
319
335
  * @param results The results to answer with.
320
336
  */
321
337
  answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
322
- use(...middleware: Middleware<C>[]): Composer<C>;
323
- branch(predicate: (ctx: C) => MaybePromise<boolean>, trueHandler_: Middleware<C>, falseHandler_: Middleware<C>): Composer<C>;
324
- filter<D extends C>(predicate: (ctx: C) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
325
- filter(predicate: (ctx: C) => MaybePromise<boolean>, ...middleware: Middleware<C>[]): Composer<C>;
326
- on<T extends keyof Update, F extends string, K extends keyof MessageTypes | null = null>(filter: T extends MessageUpdates ? T | [T, K, ...F[]] : T, ...middleawre: Middleware<FilterUpdate<C, T, F, K extends keyof MessageTypes ? MessageTypes[K] : C[T]>>[]): Composer<FilterUpdate<C, T, F, K extends keyof MessageTypes ? MessageTypes[K] : C[T]>>;
338
+ use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
339
+ branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
340
+ filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
341
+ filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
342
+ on<T extends keyof UpdateMap, F extends string, K extends keyof MessageTypes>(filter: T extends "message" | "editedMessage" ? T | [T, K, ...F[]] : T, ...middleawre: Middleware<WithUpdate<C, T, K, F>>[]): Composer<WithUpdate<C, T, K, F>>;
327
343
  command(commands: string | RegExp | (string | RegExp)[] | {
328
344
  names: string | RegExp | (string | RegExp)[];
329
345
  prefixes: string | string[];
330
- }, ...middleawre: Middleware<FilterUpdate<C, "message", "text">>[]): Composer<FilterUpdate<C, "message", string, MessageText>>;
346
+ }, ...middleawre: Middleware<WithUpdate<C, "message", "text">>[]): Composer<WithUpdate<C, "message", "text", string>>;
331
347
  /**
332
348
  * Set the bot's description in the given language. Bot-only.
333
349
  *
334
350
  * @method
335
351
  */
336
- setMyDescription({ description, languageCode }: {
352
+ setMyDescription(params?: {
337
353
  description?: string;
338
354
  languageCode?: string;
339
355
  }): Promise<void>;
@@ -342,7 +358,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
342
358
  *
343
359
  * @method
344
360
  */
345
- setMyName({ name, languageCode }: {
361
+ setMyName(params?: {
346
362
  name?: string;
347
363
  languageCode?: string;
348
364
  }): Promise<void>;
@@ -351,7 +367,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
351
367
  *
352
368
  * @method
353
369
  */
354
- setMyShortDescription({ shortDescription: about, languageCode }: {
370
+ setMyShortDescription(params?: {
355
371
  shortDescription?: string;
356
372
  languageCode?: string;
357
373
  }): Promise<void>;
@@ -528,12 +544,28 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
528
544
  */
529
545
  setAvailableReactions(chatId: ChatID, availableReactions: "none" | "all" | Reaction[]): Promise<void>;
530
546
  /**
531
- * Add a reaction to a message.
547
+ * Change reactions made to a message.
548
+ *
549
+ * @param chatId The identifier of the chat which the message belongs to.
550
+ * @param messageId The identifier of the message to add the reaction to.
551
+ * @param reactions The new reactions.
552
+ */
553
+ setReactions(chatId: number, messageId: number, reactions: Reaction[], params?: SetReactionsParams): Promise<void>;
554
+ /**
555
+ * Make a reaction to a message.
532
556
  *
533
557
  * @param chatId The identifier of the chat which the message belongs to.
534
558
  * @param messageId The identifier of the message to add the reaction to.
535
559
  * @param reaction The reaction to add.
536
560
  */
537
561
  addReaction(chatId: number, messageId: number, reaction: Reaction, params?: AddReactionParams): Promise<void>;
562
+ /**
563
+ * Undo a reaction made to a message.
564
+ *
565
+ * @param chatId The identifier of the chat which the message belongs to.
566
+ * @param messageId The identifier of the message which the reaction was made to.
567
+ * @param reaction The reaction to remove.
568
+ */
569
+ removeReaction(chatId: number, messageId: number, reaction: Reaction): Promise<void>;
538
570
  }
539
571
  export {};