@mtkruto/node 0.0.993 → 0.0.994
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.
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/5_client.d.ts +2 -1
- package/esm/5_client.js +2 -1
- package/esm/client/0_message.d.ts +3 -3
- package/esm/client/0_message.js +3 -3
- package/esm/client/0_utilities.d.ts +2 -0
- package/esm/client/0_utilities.js +1 -0
- package/esm/client/3_types.d.ts +221 -0
- package/esm/client/3_types.js +1 -0
- package/esm/client/4_composer.d.ts +13 -0
- package/esm/client/4_composer.js +80 -0
- package/esm/client/5_client.d.ts +207 -0
- package/esm/client/{3_client.js → 5_client.js} +92 -153
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/tl/6_message.d.ts +2 -2
- package/esm/tl/6_message.js +2 -2
- package/esm/tl/7_message_container.d.ts +3 -3
- package/esm/tl/7_message_container.js +2 -2
- package/package.json +1 -1
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/5_client.d.ts +2 -1
- package/script/5_client.js +4 -1
- package/script/client/0_message.d.ts +3 -3
- package/script/client/0_message.js +2 -2
- package/script/client/0_utilities.d.ts +2 -0
- package/script/client/0_utilities.js +3 -1
- package/script/client/3_types.d.ts +221 -0
- package/script/client/3_types.js +2 -0
- package/script/client/4_composer.d.ts +13 -0
- package/script/client/4_composer.js +85 -0
- package/script/client/5_client.d.ts +207 -0
- package/script/client/{3_client.js → 5_client.js} +91 -151
- package/script/mod.d.ts +1 -1
- package/script/mod.js +2 -14
- package/script/tl/6_message.d.ts +2 -2
- package/script/tl/6_message.js +4 -4
- package/script/tl/7_message_container.d.ts +3 -3
- package/script/tl/7_message_container.js +1 -1
- package/esm/client/3_client.d.ts +0 -414
- package/script/client/3_client.d.ts +0 -414
package/esm/client/3_client.d.ts
DELETED
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
import { MaybePromise } from "../1_utilities.js";
|
|
2
|
-
import { functions, ReadObject, types } from "../2_tl.js";
|
|
3
|
-
import { Storage } from "../3_storage.js";
|
|
4
|
-
import { DC } from "../3_transport.js";
|
|
5
|
-
import { CallbackQuery, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, // high-level Telegram API message
|
|
6
|
-
MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
|
|
7
|
-
import { ClientPlainParams } from "./2_client_plain.js";
|
|
8
|
-
import { ClientAbstract } from "./1_client_abstract.js";
|
|
9
|
-
export declare const getEntity: unique symbol;
|
|
10
|
-
export declare const getStickerSetName: unique symbol;
|
|
11
|
-
export declare const handleMigrationError: unique symbol;
|
|
12
|
-
export declare const getMessageWithReply: unique symbol;
|
|
13
|
-
export declare const restartAuth: unique symbol;
|
|
14
|
-
export declare enum ParseMode {
|
|
15
|
-
None = "none",
|
|
16
|
-
HTML = "html"
|
|
17
|
-
}
|
|
18
|
-
export interface AuthorizeUserParams<S = string> {
|
|
19
|
-
phone: S | (() => MaybePromise<S>);
|
|
20
|
-
code: S | (() => MaybePromise<S>);
|
|
21
|
-
password: S | ((hint: string | null) => MaybePromise<S>);
|
|
22
|
-
}
|
|
23
|
-
export interface ClientParams extends ClientPlainParams {
|
|
24
|
-
/**
|
|
25
|
-
* A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`.
|
|
26
|
-
*/
|
|
27
|
-
parseMode?: ParseMode;
|
|
28
|
-
/**
|
|
29
|
-
* 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.
|
|
30
|
-
*/
|
|
31
|
-
appVersion?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The device_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
|
|
34
|
-
*/
|
|
35
|
-
deviceModel?: string;
|
|
36
|
-
/**
|
|
37
|
-
* The lang_code parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
|
|
38
|
-
*/
|
|
39
|
-
langCode?: string;
|
|
40
|
-
/**
|
|
41
|
-
* The lang_pack parameter to be passed to initConnection when calling `authorize`. Defaults to an empty string.
|
|
42
|
-
*/
|
|
43
|
-
langPack?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The system_lang_cde parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
|
|
46
|
-
*/
|
|
47
|
-
systemLangCode?: string;
|
|
48
|
-
/**
|
|
49
|
-
* The system_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
|
|
50
|
-
*/
|
|
51
|
-
systemVersion?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to automatically call `start` with no parameters in the first `invoke` call. Defaults to `true`.
|
|
54
|
-
*/
|
|
55
|
-
autoStart?: boolean;
|
|
56
|
-
}
|
|
57
|
-
export interface AnswerCallbackQueryParams {
|
|
58
|
-
/** Text of the answer */
|
|
59
|
-
text?: string;
|
|
60
|
-
/** Pass true to show an alert to the user instead of a toast notification */
|
|
61
|
-
alert?: boolean;
|
|
62
|
-
/** URL to be opened */
|
|
63
|
-
url?: string;
|
|
64
|
-
/** Time during which the result of the query can be cached, in seconds */
|
|
65
|
-
cacheTime?: number;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* A chat identifier as provided by MTKruto or a string starting with a @ that is followed by a username.
|
|
69
|
-
*/
|
|
70
|
-
export type ChatID = number | string;
|
|
71
|
-
export interface SendMessagesParams {
|
|
72
|
-
/**
|
|
73
|
-
* The parse mode to use. If not provided, the default parse mode will be used.
|
|
74
|
-
*/
|
|
75
|
-
parseMode?: ParseMode;
|
|
76
|
-
/**
|
|
77
|
-
* The message's entities.
|
|
78
|
-
*/
|
|
79
|
-
entities?: MessageEntity[];
|
|
80
|
-
/**
|
|
81
|
-
* Whether to disable web page previews in the message that is to be sent.
|
|
82
|
-
*/
|
|
83
|
-
disableWebPagePreview?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Whether to send the message in a silent way without making a sound on the recipients' clients.
|
|
86
|
-
*/
|
|
87
|
-
disableNotification?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Whether to protect the contents of the message from copying and forwarding.
|
|
90
|
-
*/
|
|
91
|
-
protectContent?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* The identifier of a message to reply to.
|
|
94
|
-
*/
|
|
95
|
-
replyToMessageId?: number;
|
|
96
|
-
/**
|
|
97
|
-
* The identifier of a thread to send the message to.
|
|
98
|
-
*/
|
|
99
|
-
messageThreadId?: number;
|
|
100
|
-
/**
|
|
101
|
-
* The identifier of the chat to send the message on behalf of. User-only.
|
|
102
|
-
*/
|
|
103
|
-
sendAs?: ChatID;
|
|
104
|
-
/**
|
|
105
|
-
* The reply markup of the message. Bot-only.
|
|
106
|
-
*/
|
|
107
|
-
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
108
|
-
}
|
|
109
|
-
export interface EditMessageParams {
|
|
110
|
-
/**
|
|
111
|
-
* The parse mode to use. If not provided, the default parse mode will be used.
|
|
112
|
-
*/
|
|
113
|
-
parseMode?: ParseMode;
|
|
114
|
-
/**
|
|
115
|
-
* The message's entities.
|
|
116
|
-
*/
|
|
117
|
-
entities?: MessageEntity[];
|
|
118
|
-
/**
|
|
119
|
-
* Whether to disable web page previews in the message that is to be edited.
|
|
120
|
-
*/
|
|
121
|
-
disableWebPagePreview?: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* The reply markup of the message. Bot-only.
|
|
124
|
-
*/
|
|
125
|
-
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
126
|
-
}
|
|
127
|
-
export interface ForwardMessagesParams {
|
|
128
|
-
messageThreadId?: number;
|
|
129
|
-
/**
|
|
130
|
-
* Whether to forward the message in a silent way without making a sound on the recipients' clients.
|
|
131
|
-
*/
|
|
132
|
-
disableNotification?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Whether to protect the contents of the forwarded message from copying and forwarding.
|
|
135
|
-
*/
|
|
136
|
-
protectContent?: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* The identifier of the chat to forward the message on behalf of. User-only.
|
|
139
|
-
*/
|
|
140
|
-
sendAs?: ChatID;
|
|
141
|
-
/**
|
|
142
|
-
* Whether to not include the original sender of the message that is going to be forwarded.
|
|
143
|
-
*/
|
|
144
|
-
dropSenderName?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Whether to not include the original caption of the message that is going to be forwarded.
|
|
147
|
-
*/
|
|
148
|
-
dropCaption?: boolean;
|
|
149
|
-
}
|
|
150
|
-
export declare class Client extends ClientAbstract {
|
|
151
|
-
readonly storage: Storage;
|
|
152
|
-
readonly apiId: number | null;
|
|
153
|
-
readonly apiHash: string | null;
|
|
154
|
-
private auth;
|
|
155
|
-
private sessionId;
|
|
156
|
-
private state;
|
|
157
|
-
private promises;
|
|
158
|
-
private toAcknowledge;
|
|
159
|
-
private updateState?;
|
|
160
|
-
readonly parseMode: ParseMode;
|
|
161
|
-
readonly appVersion: string;
|
|
162
|
-
readonly deviceModel: string;
|
|
163
|
-
readonly langCode: string;
|
|
164
|
-
readonly langPack: string;
|
|
165
|
-
readonly systemLangCode: string;
|
|
166
|
-
readonly systemVersion: string;
|
|
167
|
-
private readonly publicKeys?;
|
|
168
|
-
private readonly autoStart;
|
|
169
|
-
/**
|
|
170
|
-
* Constructs the client.
|
|
171
|
-
*
|
|
172
|
-
* @param storage The storage provider to use. Defaults to memory storage.
|
|
173
|
-
* @param apiId App's API ID from [my.telegram.org](https://my.telegram.org/apps). Defaults to 0 (unset).
|
|
174
|
-
* @param apiHash App's API hash from [my.telegram.org/apps](https://my.telegram.org/apps). Defaults to empty string (unset).
|
|
175
|
-
* @param params Other parameters.
|
|
176
|
-
*/
|
|
177
|
-
constructor(storage?: Storage, apiId?: number | null, apiHash?: string | null, params?: ClientParams);
|
|
178
|
-
private propagateConnectionState;
|
|
179
|
-
private lastPropagatedConnectionState;
|
|
180
|
-
protected stateChangeHandler: (connected: boolean) => void;
|
|
181
|
-
private storageInited;
|
|
182
|
-
/**
|
|
183
|
-
* Sets the DC and resets the auth key stored in the session provider
|
|
184
|
-
* if the stored DC was not the same as the `dc` parameter.
|
|
185
|
-
*
|
|
186
|
-
* @param dc The DC to change to.
|
|
187
|
-
*/
|
|
188
|
-
setDc(dc: DC): Promise<void>;
|
|
189
|
-
private setAuth;
|
|
190
|
-
private connectMutex;
|
|
191
|
-
/**
|
|
192
|
-
* Loads the session if `setDc` was not called, initializes and connnects
|
|
193
|
-
* a `ClientPlain` to generate auth key if there was none, and connects the client.
|
|
194
|
-
* Before establishing the connection, the session is saved.
|
|
195
|
-
*/
|
|
196
|
-
connect(): Promise<void>;
|
|
197
|
-
private fetchState;
|
|
198
|
-
[handleMigrationError](err: types.RPCError): Promise<void>;
|
|
199
|
-
private connectionInited;
|
|
200
|
-
disconnect(): Promise<void>;
|
|
201
|
-
private initConnection;
|
|
202
|
-
private lastPropagatedAuthorizationState;
|
|
203
|
-
private propagateAuthorizationState;
|
|
204
|
-
/**
|
|
205
|
-
* Calls [initConnection](1) and authorizes the client with one of the following:
|
|
206
|
-
*
|
|
207
|
-
* - Bot token (`string`)
|
|
208
|
-
* - Exported authorization (`types.AuthExportedAuthorization`)
|
|
209
|
-
* - User authorization handlers (`AuthorizeUserParams`)
|
|
210
|
-
*
|
|
211
|
-
* if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](2).
|
|
212
|
-
*
|
|
213
|
-
* Notes:
|
|
214
|
-
* 1. Requires the `apiId` and `apiHash` paramters to be passed when constructing the client.
|
|
215
|
-
* 2. Reconnects the client to the appropriate DC in case of MIGRATE_X errors.
|
|
216
|
-
* 3. The parameters passed to the [initConnection][1] call can be configured with the last parameter of the constructor.
|
|
217
|
-
*
|
|
218
|
-
* [1]: https://core.telegram.org/method/initConnection
|
|
219
|
-
* [2]: https://core.telegram.org/method/updates.getState
|
|
220
|
-
*/
|
|
221
|
-
authorize(params?: string | types.AuthExportedAuthorization | AuthorizeUserParams): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Same as calling `.connect()` followed by `.authorize(params)`.
|
|
224
|
-
*/
|
|
225
|
-
start(params?: string | types.AuthExportedAuthorization | AuthorizeUserParams): Promise<void>;
|
|
226
|
-
private receiveLoop;
|
|
227
|
-
private pingLoop;
|
|
228
|
-
private autoStarted;
|
|
229
|
-
private lastMsgId;
|
|
230
|
-
/**
|
|
231
|
-
* Invokes a function waiting and returning its reply if the second parameter is not `true`. Requires the client
|
|
232
|
-
* to be connected.
|
|
233
|
-
*
|
|
234
|
-
* @param function_ The function to invoke.
|
|
235
|
-
*/
|
|
236
|
-
invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
|
|
237
|
-
invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, noWait: true): Promise<void>;
|
|
238
|
-
/**
|
|
239
|
-
* Alias for `invoke` with its second parameter being `true`.
|
|
240
|
-
*/
|
|
241
|
-
send<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<void>;
|
|
242
|
-
private processChats;
|
|
243
|
-
private processUsers;
|
|
244
|
-
private handleUpdateQueue;
|
|
245
|
-
private processUpdatesQueue;
|
|
246
|
-
private checkGap;
|
|
247
|
-
private checkChannelGap;
|
|
248
|
-
private processUpdates;
|
|
249
|
-
private setUpdateStateDate;
|
|
250
|
-
private getLocalState;
|
|
251
|
-
private recoverUpdateGap;
|
|
252
|
-
private recoverChannelUpdateGap;
|
|
253
|
-
private getUserAccessHash;
|
|
254
|
-
private getChannelAccessHash;
|
|
255
|
-
getInputPeer(id: ChatID): Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
|
|
256
|
-
private getInputPeerInner;
|
|
257
|
-
[getEntity](peer: types.PeerUser): Promise<types.User | null>;
|
|
258
|
-
[getEntity](peer: types.PeerChat): Promise<types.Chat | null>;
|
|
259
|
-
[getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
|
|
260
|
-
processResult(result: ReadObject): Promise<void>;
|
|
261
|
-
private updatesToMessages;
|
|
262
|
-
/**
|
|
263
|
-
* Send a text message.
|
|
264
|
-
*
|
|
265
|
-
* @param chatId The chat to send the message to.
|
|
266
|
-
* @param text The message's text.
|
|
267
|
-
*/
|
|
268
|
-
sendMessage(chatId: ChatID, text: string, params?: SendMessagesParams): Promise<Message>;
|
|
269
|
-
/**
|
|
270
|
-
* Edit a message's text.
|
|
271
|
-
*
|
|
272
|
-
* @param chatId The chat where the message is.
|
|
273
|
-
* @param messageId The ID of the message.
|
|
274
|
-
* @param text The new text of the message.
|
|
275
|
-
*/
|
|
276
|
-
editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<void>;
|
|
277
|
-
private getMessagesInner;
|
|
278
|
-
/**
|
|
279
|
-
* Retrieve multiple messages.
|
|
280
|
-
*
|
|
281
|
-
* @param chatId The identifier of the chat to retrieve the messages from.
|
|
282
|
-
* @param messageIds The identifiers of the messages to retrieve.
|
|
283
|
-
*/
|
|
284
|
-
getMessages(chatId_: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
|
|
285
|
-
[getMessageWithReply](chatId: ChatID, messageId: number): Promise<Message | null>;
|
|
286
|
-
/**
|
|
287
|
-
* Retrieve a single message.
|
|
288
|
-
*
|
|
289
|
-
* @param chatId The identifier of the chat to retrieve the message from.
|
|
290
|
-
* @param messageId The identifier of the message to retrieve.
|
|
291
|
-
*/
|
|
292
|
-
getMessage(chatId: ChatID, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
|
|
293
|
-
private downloadInner;
|
|
294
|
-
/**
|
|
295
|
-
* Download a file.
|
|
296
|
-
*
|
|
297
|
-
* @param fileId The identifier of the file to download.
|
|
298
|
-
*/
|
|
299
|
-
download(fileId: string): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
|
|
300
|
-
[getStickerSetName](inputStickerSet: types.InputStickerSetID, hash?: number): Promise<string>;
|
|
301
|
-
/**
|
|
302
|
-
* Forward multiple messages.
|
|
303
|
-
*
|
|
304
|
-
* @param from The identifier of the chat to forward the messages from.
|
|
305
|
-
* @param to The identifier of the chat to forward the messages to.
|
|
306
|
-
* @param messageIds The identifiers of the messages to forward.
|
|
307
|
-
*/
|
|
308
|
-
forwardMessages(from: ChatID, to: ChatID, messageIds: number[], params?: ForwardMessagesParams): Promise<Message[]>;
|
|
309
|
-
/**
|
|
310
|
-
* Forward a single message.
|
|
311
|
-
*
|
|
312
|
-
* @param from The identifier of the chat to forward the message from.
|
|
313
|
-
* @param to The identifier of the chat to forward the message to.
|
|
314
|
-
* @param messageId The identifier of the message to forward.
|
|
315
|
-
*/
|
|
316
|
-
forwardMessage(from: ChatID, to: ChatID, messageId: number, params?: ForwardMessagesParams): Promise<Message>;
|
|
317
|
-
/**
|
|
318
|
-
* Get information on the currently authorized user.
|
|
319
|
-
*/
|
|
320
|
-
getMe(): Promise<import("../3_types.js").User>;
|
|
321
|
-
private handleUpdate;
|
|
322
|
-
handler: Handler;
|
|
323
|
-
use(middleware: Handler): void;
|
|
324
|
-
on<U extends keyof Update, K extends keyof Update[U]>(filter: U extends FilterableUpdates ? U | [U, K, ...K[]] : U, handler: Handler<Pick<{
|
|
325
|
-
[P in U]: With<Update[U], K>;
|
|
326
|
-
}, U>>): void;
|
|
327
|
-
/**
|
|
328
|
-
* Answer a callback query. Bot-only.
|
|
329
|
-
*
|
|
330
|
-
* @param id ID of the callback query to answer.
|
|
331
|
-
*/
|
|
332
|
-
answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
|
|
333
|
-
sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<void>;
|
|
334
|
-
}
|
|
335
|
-
export interface SendPollParams {
|
|
336
|
-
/**
|
|
337
|
-
* True, if the poll needs to be anonymous, defaults to True */
|
|
338
|
-
isAnonymous?: boolean;
|
|
339
|
-
/**
|
|
340
|
-
* The type of the poll. Defaults to regular. */
|
|
341
|
-
type?: "quiz" | "regular";
|
|
342
|
-
/**
|
|
343
|
-
* True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False */
|
|
344
|
-
allowMultipleAnswers?: boolean;
|
|
345
|
-
/**
|
|
346
|
-
* Index of the correct option. Required for quizzes. */
|
|
347
|
-
correctOptionIndex?: number;
|
|
348
|
-
/**
|
|
349
|
-
* Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing */
|
|
350
|
-
explanation?: string;
|
|
351
|
-
/**
|
|
352
|
-
* The parse mode to use for the explanation. If not provided, the default parse mode will be used.
|
|
353
|
-
*/
|
|
354
|
-
explanationParseMode?: ParseMode;
|
|
355
|
-
/**
|
|
356
|
-
* The explanation's entities.
|
|
357
|
-
*/
|
|
358
|
-
explanationEntities?: MessageEntity[];
|
|
359
|
-
/**
|
|
360
|
-
* Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
|
|
361
|
-
*/
|
|
362
|
-
openPeriod?: number;
|
|
363
|
-
/**
|
|
364
|
-
* Point in time when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
|
|
365
|
-
*/
|
|
366
|
-
closeDate?: Date;
|
|
367
|
-
/**
|
|
368
|
-
* Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
|
|
369
|
-
*/
|
|
370
|
-
isClosed?: boolean;
|
|
371
|
-
/**
|
|
372
|
-
* Whether to send the message in a silent way without making a sound on the recipients' clients.
|
|
373
|
-
*/
|
|
374
|
-
disableNotification?: boolean;
|
|
375
|
-
/**
|
|
376
|
-
* The identifier of a message to reply to.
|
|
377
|
-
*/
|
|
378
|
-
replyToMessageId?: number;
|
|
379
|
-
/**
|
|
380
|
-
* The identifier of a thread to send the message to.
|
|
381
|
-
*/
|
|
382
|
-
messageThreadId?: number;
|
|
383
|
-
/**
|
|
384
|
-
* The identifier of the chat to send the message on behalf of. User-only.
|
|
385
|
-
*/
|
|
386
|
-
sendAs?: ChatID;
|
|
387
|
-
/**
|
|
388
|
-
* The reply markup of the message. Bot-only.
|
|
389
|
-
*/
|
|
390
|
-
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
391
|
-
/**
|
|
392
|
-
* Whether to protect the contents of the message from copying and forwarding.
|
|
393
|
-
*/
|
|
394
|
-
protectContent?: boolean;
|
|
395
|
-
}
|
|
396
|
-
type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
397
|
-
export type ConnectionState = "not-connected" | "updating" | "ready";
|
|
398
|
-
export type AuthorizationState = {
|
|
399
|
-
authorized: boolean;
|
|
400
|
-
};
|
|
401
|
-
type FilterableUpdates = "message" | "editedMessage" | "callbackQuery";
|
|
402
|
-
export interface Update {
|
|
403
|
-
message: Message;
|
|
404
|
-
editedMessage: Message;
|
|
405
|
-
connectionState: ConnectionState;
|
|
406
|
-
authorizationState: AuthorizationState;
|
|
407
|
-
deletedMessages: [Message, ...Message[]];
|
|
408
|
-
callbackQuery: CallbackQuery;
|
|
409
|
-
inlineQuery: InlineQuery;
|
|
410
|
-
}
|
|
411
|
-
export interface Handler<U extends Partial<Update> = Partial<Update>> {
|
|
412
|
-
(update: U, next: () => Promise<void>): MaybePromise<void>;
|
|
413
|
-
}
|
|
414
|
-
export {};
|