@mtkruto/node 0.0.992 → 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.
Files changed (41) hide show
  1. package/esm/4_constants.d.ts +1 -1
  2. package/esm/4_constants.js +1 -1
  3. package/esm/5_client.d.ts +2 -1
  4. package/esm/5_client.js +2 -1
  5. package/esm/client/0_message.d.ts +3 -3
  6. package/esm/client/0_message.js +3 -3
  7. package/esm/client/0_utilities.d.ts +2 -0
  8. package/esm/client/0_utilities.js +1 -0
  9. package/esm/client/3_types.d.ts +221 -0
  10. package/esm/client/3_types.js +1 -0
  11. package/esm/client/4_composer.d.ts +13 -0
  12. package/esm/client/4_composer.js +80 -0
  13. package/esm/client/{3_client.d.ts → 5_client.d.ts} +20 -165
  14. package/esm/client/{3_client.js → 5_client.js} +143 -127
  15. package/esm/mod.d.ts +1 -0
  16. package/esm/mod.js +1 -0
  17. package/esm/tl/6_message.d.ts +2 -2
  18. package/esm/tl/6_message.js +2 -2
  19. package/esm/tl/7_message_container.d.ts +3 -3
  20. package/esm/tl/7_message_container.js +2 -2
  21. package/package.json +1 -1
  22. package/script/4_constants.d.ts +1 -1
  23. package/script/4_constants.js +1 -1
  24. package/script/5_client.d.ts +2 -1
  25. package/script/5_client.js +4 -1
  26. package/script/client/0_message.d.ts +3 -3
  27. package/script/client/0_message.js +2 -2
  28. package/script/client/0_utilities.d.ts +2 -0
  29. package/script/client/0_utilities.js +3 -1
  30. package/script/client/3_types.d.ts +221 -0
  31. package/script/client/3_types.js +2 -0
  32. package/script/client/4_composer.d.ts +13 -0
  33. package/script/client/4_composer.js +85 -0
  34. package/script/client/{3_client.d.ts → 5_client.d.ts} +20 -165
  35. package/script/client/{3_client.js → 5_client.js} +142 -125
  36. package/script/mod.d.ts +1 -0
  37. package/script/mod.js +1 -0
  38. package/script/tl/6_message.d.ts +2 -2
  39. package/script/tl/6_message.js +4 -4
  40. package/script/tl/7_message_container.d.ts +3 -3
  41. package/script/tl/7_message_container.js +1 -1
@@ -0,0 +1,221 @@
1
+ import { MaybePromise } from "../1_utilities.js";
2
+ import { CallbackQuery, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
3
+ import { With } from "./0_utilities.js";
4
+ import { ClientPlainParams } from "./2_client_plain.js";
5
+ export type ParseMode = "html" | "none";
6
+ export interface ClientParams extends ClientPlainParams {
7
+ /**
8
+ * A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`.
9
+ */
10
+ parseMode?: ParseMode;
11
+ /**
12
+ * 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.
13
+ */
14
+ appVersion?: string;
15
+ /**
16
+ * The device_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
17
+ */
18
+ deviceModel?: string;
19
+ /**
20
+ * The lang_code parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
21
+ */
22
+ langCode?: string;
23
+ /**
24
+ * The lang_pack parameter to be passed to initConnection when calling `authorize`. Defaults to an empty string.
25
+ */
26
+ langPack?: string;
27
+ /**
28
+ * The system_lang_cde parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
29
+ */
30
+ systemLangCode?: string;
31
+ /**
32
+ * The system_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
33
+ */
34
+ systemVersion?: string;
35
+ /**
36
+ * Whether to automatically call `start` with no parameters in the first `invoke` call. Defaults to `true`.
37
+ */
38
+ autoStart?: boolean;
39
+ }
40
+ export interface AnswerCallbackQueryParams {
41
+ /** Text of the answer */
42
+ text?: string;
43
+ /** Pass true to show an alert to the user instead of a toast notification */
44
+ alert?: boolean;
45
+ /** URL to be opened */
46
+ url?: string;
47
+ /** Time during which the result of the query can be cached, in seconds */
48
+ cacheTime?: number;
49
+ }
50
+ export interface AuthorizeUserParams<S = string> {
51
+ phone: S | (() => MaybePromise<S>);
52
+ code: S | (() => MaybePromise<S>);
53
+ password: S | ((hint: string | null) => MaybePromise<S>);
54
+ }
55
+ /**
56
+ * A chat identifier as provided by MTKruto or a string starting with a @ that is followed by a username.
57
+ */
58
+ export type ChatID = number | string;
59
+ export interface SendMessagesParams {
60
+ /**
61
+ * The parse mode to use. If not provided, the default parse mode will be used.
62
+ */
63
+ parseMode?: ParseMode;
64
+ /**
65
+ * The message's entities.
66
+ */
67
+ entities?: MessageEntity[];
68
+ /**
69
+ * Whether to disable web page previews in the message that is to be sent.
70
+ */
71
+ disableWebPagePreview?: boolean;
72
+ /**
73
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
74
+ */
75
+ disableNotification?: boolean;
76
+ /**
77
+ * Whether to protect the contents of the message from copying and forwarding.
78
+ */
79
+ protectContent?: boolean;
80
+ /**
81
+ * The identifier of a message to reply to.
82
+ */
83
+ replyToMessageId?: number;
84
+ /**
85
+ * The identifier of a thread to send the message to.
86
+ */
87
+ messageThreadId?: number;
88
+ /**
89
+ * The identifier of the chat to send the message on behalf of. User-only.
90
+ */
91
+ sendAs?: ChatID;
92
+ /**
93
+ * The reply markup of the message. Bot-only.
94
+ */
95
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
96
+ }
97
+ export interface EditMessageParams {
98
+ /**
99
+ * The parse mode to use. If not provided, the default parse mode will be used.
100
+ */
101
+ parseMode?: ParseMode;
102
+ /**
103
+ * The message's entities.
104
+ */
105
+ entities?: MessageEntity[];
106
+ /**
107
+ * Whether to disable web page previews in the message that is to be edited.
108
+ */
109
+ disableWebPagePreview?: boolean;
110
+ /**
111
+ * The reply markup of the message. Bot-only.
112
+ */
113
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
114
+ }
115
+ export interface ForwardMessagesParams {
116
+ messageThreadId?: number;
117
+ /**
118
+ * Whether to forward the message in a silent way without making a sound on the recipients' clients.
119
+ */
120
+ disableNotification?: boolean;
121
+ /**
122
+ * Whether to protect the contents of the forwarded message from copying and forwarding.
123
+ */
124
+ protectContent?: boolean;
125
+ /**
126
+ * The identifier of the chat to forward the message on behalf of. User-only.
127
+ */
128
+ sendAs?: ChatID;
129
+ /**
130
+ * Whether to not include the original sender of the message that is going to be forwarded.
131
+ */
132
+ dropSenderName?: boolean;
133
+ /**
134
+ * Whether to not include the original caption of the message that is going to be forwarded.
135
+ */
136
+ dropCaption?: boolean;
137
+ }
138
+ export interface SendPollParams {
139
+ /**
140
+ * True, if the poll needs to be anonymous, defaults to True */
141
+ isAnonymous?: boolean;
142
+ /**
143
+ * The type of the poll. Defaults to regular. */
144
+ type?: "quiz" | "regular";
145
+ /**
146
+ * True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False */
147
+ allowMultipleAnswers?: boolean;
148
+ /**
149
+ * Index of the correct option. Required for quizzes. */
150
+ correctOptionIndex?: number;
151
+ /**
152
+ * 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 */
153
+ explanation?: string;
154
+ /**
155
+ * The parse mode to use for the explanation. If not provided, the default parse mode will be used.
156
+ */
157
+ explanationParseMode?: ParseMode;
158
+ /**
159
+ * The explanation's entities.
160
+ */
161
+ explanationEntities?: MessageEntity[];
162
+ /**
163
+ * Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
164
+ */
165
+ openPeriod?: number;
166
+ /**
167
+ * 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.
168
+ */
169
+ closeDate?: Date;
170
+ /**
171
+ * Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
172
+ */
173
+ isClosed?: boolean;
174
+ /**
175
+ * Whether to send the message in a silent way without making a sound on the recipients' clients.
176
+ */
177
+ disableNotification?: boolean;
178
+ /**
179
+ * The identifier of a message to reply to.
180
+ */
181
+ replyToMessageId?: number;
182
+ /**
183
+ * The identifier of a thread to send the message to.
184
+ */
185
+ messageThreadId?: number;
186
+ /**
187
+ * The identifier of the chat to send the message on behalf of. User-only.
188
+ */
189
+ sendAs?: ChatID;
190
+ /**
191
+ * The reply markup of the message. Bot-only.
192
+ */
193
+ replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
194
+ /**
195
+ * Whether to protect the contents of the message from copying and forwarding.
196
+ */
197
+ protectContent?: boolean;
198
+ }
199
+ export type ConnectionState = "not-connected" | "updating" | "ready";
200
+ export type AuthorizationState = {
201
+ authorized: boolean;
202
+ };
203
+ export type FilterableUpdates = "message" | "editedMessage" | "callbackQuery";
204
+ export interface Update {
205
+ message?: Message;
206
+ editedMessage?: Message;
207
+ connectionState?: ConnectionState;
208
+ authorizationState?: AuthorizationState;
209
+ deletedMessages?: [Message, ...Message[]];
210
+ callbackQuery?: CallbackQuery;
211
+ inlineQuery?: InlineQuery;
212
+ }
213
+ export type NextFn = () => Promise<void>;
214
+ export interface HandlerObj<U extends Partial<Update> = Partial<Update>> {
215
+ handle(update: U, next: NextFn): MaybePromise<void>;
216
+ }
217
+ export type HandlerFn<U extends Partial<Update> = Partial<Update>> = HandlerObj<U>["handle"];
218
+ export type Handler<U extends Partial<Update> = Partial<Update>> = HandlerObj<U> | HandlerFn<U>;
219
+ export type FilterUpdate<U extends Update, T extends keyof U, F extends keyof NonNullable<U[T]>> = With<U, T> & Pick<{
220
+ [P in T]-?: With<NonNullable<U[T]>, F>;
221
+ }, T>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { MaybePromise } from "../1_utilities.js";
2
+ import { FilterableUpdates, FilterUpdate, Handler, HandlerFn, HandlerObj, Update } from "./3_types.js";
3
+ export declare function call(handler: Handler): HandlerFn;
4
+ export declare class Composer<U extends Update = Update> implements HandlerObj<U> {
5
+ constructor(...handlers: Handler<U>[]);
6
+ get handle(): HandlerFn;
7
+ private _handle;
8
+ use(...handlers: Handler<U>[]): this;
9
+ branch(predicate: (upd: U) => MaybePromise<boolean>, trueHandler: Handler<U>, falseHandler: Handler<U>): this;
10
+ filter<D extends U>(predicate: (ctx: U) => ctx is D, ...middleware: Handler<D>[]): Composer<D>;
11
+ filter(predicate: (ctx: U) => MaybePromise<boolean>, ...middleware: Handler<U>[]): Composer<U>;
12
+ on<T extends keyof U, F extends keyof NonNullable<U[T]>>(filter: T extends FilterableUpdates ? T | [T, F, ...F[]] : T, ...handlers: Handler<FilterUpdate<U, T, F>>[]): Composer<FilterUpdate<U, T, F>>;
13
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Composer = exports.call = void 0;
4
+ const _0_utilities_js_1 = require("./0_utilities.js");
5
+ function call(handler) {
6
+ if ("handle" in handler) {
7
+ return handler.handle;
8
+ }
9
+ else {
10
+ return handler;
11
+ }
12
+ }
13
+ exports.call = call;
14
+ function concat(what, with_) {
15
+ return async (upd, next) => {
16
+ let called = false;
17
+ await call(what)(upd, async () => {
18
+ if (called)
19
+ return;
20
+ called = true;
21
+ await call(with_)(upd, next);
22
+ });
23
+ };
24
+ }
25
+ function reduce(...handlers) {
26
+ return handlers.reduce((a, b) => concat(a, b));
27
+ }
28
+ class Composer {
29
+ constructor(...handlers) {
30
+ Object.defineProperty(this, "_handle", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: _0_utilities_js_1.resolve
35
+ });
36
+ this.use(...handlers);
37
+ }
38
+ get handle() {
39
+ return this._handle;
40
+ }
41
+ use(...handlers) {
42
+ const handle = this.handle;
43
+ this._handle = concat(handle, reduce(...handlers));
44
+ return this;
45
+ }
46
+ branch(predicate, trueHandler, falseHandler) {
47
+ return this.use(async (upd, next) => {
48
+ if (await predicate(upd)) {
49
+ await call(trueHandler)(upd, next);
50
+ }
51
+ else {
52
+ await call(falseHandler)(upd, next);
53
+ }
54
+ });
55
+ }
56
+ filter(predicate, ...middleware) {
57
+ const composer = new Composer(...middleware);
58
+ this.branch(predicate, composer, _0_utilities_js_1.resolve);
59
+ return composer;
60
+ }
61
+ on(filter, ...handlers) {
62
+ // deno-lint-ignore ban-ts-comment
63
+ // @ts-ignore
64
+ const type = typeof filter === "string" ? filter : filter[0];
65
+ const keys = Array.isArray(filter) ? filter.slice(1) : [];
66
+ return this.filter((update) => {
67
+ if (type in update) {
68
+ if (keys.length > 0) {
69
+ for (const key of keys) {
70
+ // deno-lint-ignore ban-ts-comment
71
+ // @ts-ignore
72
+ if (!(key in update[type])) {
73
+ return false;
74
+ }
75
+ }
76
+ }
77
+ return true;
78
+ }
79
+ else {
80
+ return false;
81
+ }
82
+ }, ...handlers);
83
+ }
84
+ }
85
+ exports.Composer = Composer;
@@ -1,152 +1,15 @@
1
- import { MaybePromise } from "../1_utilities.js";
2
1
  import { functions, ReadObject, types } from "../2_tl.js";
3
2
  import { Storage } from "../3_storage.js";
4
3
  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";
4
+ import { Message } from "../3_types.js";
5
+ import { With } from "./0_utilities.js";
8
6
  import { ClientAbstract } from "./1_client_abstract.js";
7
+ import { AnswerCallbackQueryParams, AuthorizeUserParams, ChatID, ClientParams, EditMessageParams, ForwardMessagesParams, Handler, ParseMode, SendMessagesParams, SendPollParams } from "./3_types.js";
9
8
  export declare const getEntity: unique symbol;
10
9
  export declare const getStickerSetName: unique symbol;
11
10
  export declare const handleMigrationError: unique symbol;
12
11
  export declare const getMessageWithReply: unique symbol;
13
12
  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
13
  export declare class Client extends ClientAbstract {
151
14
  readonly storage: Storage;
152
15
  readonly apiId: number | null;
@@ -194,6 +57,8 @@ export declare class Client extends ClientAbstract {
194
57
  * Before establishing the connection, the session is saved.
195
58
  */
196
59
  connect(): Promise<void>;
60
+ private assertUser;
61
+ private assertBot;
197
62
  private fetchState;
198
63
  [handleMigrationError](err: types.RPCError): Promise<void>;
199
64
  private connectionInited;
@@ -259,13 +124,15 @@ export declare class Client extends ClientAbstract {
259
124
  [getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
260
125
  processResult(result: ReadObject): Promise<void>;
261
126
  private updatesToMessages;
127
+ private resolveSendAs;
262
128
  /**
263
129
  * Send a text message.
264
130
  *
265
131
  * @param chatId The chat to send the message to.
266
132
  * @param text The message's text.
267
133
  */
268
- sendMessage(chatId: ChatID, text: string, params?: SendMessagesParams): Promise<Message>;
134
+ sendMessage(chatId: ChatID, text: string, params?: SendMessagesParams): Promise<With<Message, "text">>;
135
+ private parseText;
269
136
  /**
270
137
  * Edit a message's text.
271
138
  *
@@ -319,34 +186,22 @@ export declare class Client extends ClientAbstract {
319
186
  */
320
187
  getMe(): Promise<import("../3_types.js").User>;
321
188
  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;
189
+ private _handler;
190
+ set handler(handler: Handler);
327
191
  /**
328
192
  * Answer a callback query. Bot-only.
329
193
  *
330
194
  * @param id ID of the callback query to answer.
331
195
  */
332
196
  answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
197
+ private constructReplyMarkup;
198
+ private static assertMsgHas;
199
+ /**
200
+ * Send a poll.
201
+ *
202
+ * @param chatId The chat to send the poll to.
203
+ * @param question The poll's question.
204
+ * @param options The poll's options.
205
+ */
206
+ sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
333
207
  }
334
- type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
335
- export type ConnectionState = "not-connected" | "updating" | "ready";
336
- export type AuthorizationState = {
337
- authorized: boolean;
338
- };
339
- type FilterableUpdates = "message" | "editedMessage" | "callbackQuery";
340
- export interface Update {
341
- message: Message;
342
- editedMessage: Message;
343
- connectionState: ConnectionState;
344
- authorizationState: AuthorizationState;
345
- deletedMessages: [Message, ...Message[]];
346
- callbackQuery: CallbackQuery;
347
- inlineQuery: InlineQuery;
348
- }
349
- export interface Handler<U extends Partial<Update> = Partial<Update>> {
350
- (update: U, next: () => Promise<void>): MaybePromise<void>;
351
- }
352
- export {};