@mtkruto/node 0.0.834 → 0.0.900
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/client/client.d.ts +29 -4
- package/esm/client/client.js +528 -71
- package/esm/client/client_abstract.d.ts +1 -1
- package/esm/connection/connection.d.ts +1 -1
- package/esm/constants.d.ts +2 -0
- package/esm/constants.js +2 -0
- package/esm/deps/deno.land/std@0.190.0/encoding/base64.d.ts +11 -0
- package/esm/deps/deno.land/std@0.190.0/encoding/base64.js +140 -0
- package/esm/deps/deno.land/x/q@v0.0.1/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/q@v0.0.1/mod.js +71 -0
- package/esm/deps.d.ts +2 -0
- package/esm/deps.js +2 -0
- package/esm/mod.d.ts +3 -3
- package/esm/mod.js +3 -3
- package/esm/storage/storage.d.ts +19 -1
- package/esm/storage/storage.js +103 -0
- package/esm/storage/storage_local_storage.d.ts +1 -1
- package/esm/storage/storage_memory.d.ts +1 -1
- package/esm/storage/storage_session_storage.d.ts +1 -1
- package/esm/tl/1_tl_object.d.ts +0 -1
- package/esm/tl/1_tl_object.js +1 -1
- package/esm/tl/4_tl_writer.d.ts +5 -0
- package/esm/tl/5_rpc_result.d.ts +9 -0
- package/esm/tl/6_message.d.ts +10 -0
- package/esm/tl/{5_message.js → 6_message.js} +2 -2
- package/esm/tl/{6_message_container.d.ts → 7_message_container.d.ts} +1 -1
- package/esm/tl/{6_message_container.js → 7_message_container.js} +2 -2
- package/esm/transport/transport.d.ts +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts +17 -0
- package/esm/types/0_chat_administrator_rights.js +38 -0
- package/esm/types/0_chat_photo.d.ts +24 -0
- package/esm/types/0_chat_photo.js +28 -0
- package/esm/types/0_force_reply.d.ts +8 -0
- package/esm/types/0_force_reply.js +17 -0
- package/esm/types/0_keyboard_button_poll_type.d.ts +3 -0
- package/esm/types/0_login_url.d.ts +6 -0
- package/esm/types/0_login_url.js +1 -0
- package/esm/types/0_message_entity.d.ts +1 -1
- package/esm/types/0_message_entity.js +2 -2
- package/esm/types/0_reply_keyboard_remove.d.ts +7 -0
- package/esm/types/0_reply_keyboard_remove.js +8 -0
- package/esm/types/0_web_app_info.d.ts +4 -0
- package/esm/types/0_web_app_info.js +3 -0
- package/esm/types/1_chat.d.ts +60 -0
- package/esm/types/1_chat.js +70 -0
- package/esm/types/1_inline_keyboard_button.d.ts +33 -0
- package/esm/types/1_inline_keyboard_button.js +63 -0
- package/esm/types/1_keyboard_button.d.ts +43 -0
- package/esm/types/1_keyboard_button.js +133 -0
- package/esm/types/1_user.d.ts +19 -0
- package/esm/types/1_user.js +25 -0
- package/esm/types/2_inline_keyboard_markup.d.ts +7 -0
- package/esm/types/2_inline_keyboard_markup.js +25 -0
- package/esm/types/2_reply_keyboard_markup.d.ts +12 -0
- package/esm/types/2_reply_keyboard_markup.js +37 -0
- package/esm/types/3_message.d.ts +26 -0
- package/esm/types/3_message.js +91 -0
- package/esm/utilities/0_control.d.ts +1 -0
- package/esm/utilities/0_control.js +3 -0
- package/esm/utilities/0_object.d.ts +1 -0
- package/esm/utilities/0_object.js +14 -0
- package/esm/utilities/0_types.js +1 -0
- package/esm/utilities/1_message.d.ts +2 -2
- package/esm/utilities/1_message.js +3 -3
- package/esm/utilities/1_password.js +1 -1
- package/package.json +1 -1
- package/script/client/client.d.ts +29 -4
- package/script/client/client.js +528 -71
- package/script/client/client_abstract.d.ts +1 -1
- package/script/connection/connection.d.ts +1 -1
- package/script/constants.d.ts +2 -0
- package/script/constants.js +3 -1
- package/script/deps/deno.land/std@0.190.0/encoding/base64.d.ts +11 -0
- package/script/deps/deno.land/std@0.190.0/encoding/base64.js +145 -0
- package/script/deps/deno.land/x/q@v0.0.1/mod.d.ts +6 -0
- package/script/deps/deno.land/x/q@v0.0.1/mod.js +75 -0
- package/script/deps.d.ts +2 -0
- package/script/deps.js +6 -1
- package/script/mod.d.ts +3 -3
- package/script/mod.js +3 -3
- package/script/storage/storage.d.ts +19 -1
- package/script/storage/storage.js +126 -0
- package/script/storage/storage_local_storage.d.ts +1 -1
- package/script/storage/storage_memory.d.ts +1 -1
- package/script/storage/storage_session_storage.d.ts +1 -1
- package/script/tl/1_tl_object.d.ts +0 -1
- package/script/tl/1_tl_object.js +1 -1
- package/script/tl/4_tl_writer.d.ts +5 -0
- package/script/tl/5_rpc_result.d.ts +9 -0
- package/script/tl/6_message.d.ts +10 -0
- package/script/tl/{5_message.js → 6_message.js} +6 -6
- package/script/tl/{6_message_container.d.ts → 7_message_container.d.ts} +1 -1
- package/script/tl/{6_message_container.js → 7_message_container.js} +4 -4
- package/script/transport/transport.d.ts +1 -1
- package/script/types/0_chat_administrator_rights.d.ts +17 -0
- package/script/types/0_chat_administrator_rights.js +66 -0
- package/script/types/0_chat_photo.d.ts +24 -0
- package/script/types/0_chat_photo.js +55 -0
- package/script/types/0_force_reply.d.ts +8 -0
- package/script/types/0_force_reply.js +45 -0
- package/script/types/0_keyboard_button_poll_type.d.ts +3 -0
- package/script/types/0_login_url.d.ts +6 -0
- package/script/types/0_login_url.js +2 -0
- package/script/types/0_message_entity.d.ts +1 -1
- package/script/types/0_message_entity.js +2 -2
- package/script/types/0_reply_keyboard_remove.d.ts +7 -0
- package/script/types/0_reply_keyboard_remove.js +36 -0
- package/script/types/0_web_app_info.d.ts +4 -0
- package/script/types/0_web_app_info.js +7 -0
- package/script/types/1_chat.d.ts +60 -0
- package/script/types/1_chat.js +97 -0
- package/script/types/1_inline_keyboard_button.d.ts +33 -0
- package/script/types/1_inline_keyboard_button.js +91 -0
- package/script/types/1_keyboard_button.d.ts +43 -0
- package/script/types/1_keyboard_button.js +161 -0
- package/script/types/1_user.d.ts +19 -0
- package/script/types/1_user.js +52 -0
- package/script/types/2_inline_keyboard_markup.d.ts +7 -0
- package/script/types/2_inline_keyboard_markup.js +53 -0
- package/script/types/2_reply_keyboard_markup.d.ts +12 -0
- package/script/types/2_reply_keyboard_markup.js +65 -0
- package/script/types/3_message.d.ts +26 -0
- package/script/types/3_message.js +118 -0
- package/script/utilities/0_control.d.ts +1 -0
- package/script/utilities/0_control.js +7 -0
- package/script/utilities/0_object.d.ts +1 -0
- package/script/utilities/0_object.js +18 -0
- package/script/utilities/0_types.js +2 -0
- package/script/utilities/1_message.d.ts +2 -2
- package/script/utilities/1_message.js +9 -9
- package/script/utilities/1_password.js +1 -1
- package/esm/tl/3_tl_writer.d.ts +0 -5
- package/esm/tl/4_rpc_result.d.ts +0 -8
- package/esm/tl/5_message.d.ts +0 -11
- package/script/tl/3_tl_writer.d.ts +0 -5
- package/script/tl/4_rpc_result.d.ts +0 -8
- package/script/tl/5_message.d.ts +0 -11
- /package/esm/tl/{3_tl_writer.js → 4_tl_writer.js} +0 -0
- /package/esm/tl/{4_rpc_result.js → 5_rpc_result.js} +0 -0
- /package/esm/{types.js → types/0_keyboard_button_poll_type.js} +0 -0
- /package/esm/{types.d.ts → utilities/0_types.d.ts} +0 -0
- /package/script/tl/{3_tl_writer.js → 4_tl_writer.js} +0 -0
- /package/script/tl/{4_rpc_result.js → 5_rpc_result.js} +0 -0
- /package/script/{types.js → types/0_keyboard_button_poll_type.js} +0 -0
- /package/script/{types.d.ts → utilities/0_types.d.ts} +0 -0
package/esm/client/client.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { MaybePromise } from "../
|
|
1
|
+
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
2
|
import * as types from "../tl/2_types.js";
|
|
3
3
|
import * as functions from "../tl/3_functions.js";
|
|
4
|
+
import { ReadObject } from "../tl/3_tl_reader.js";
|
|
4
5
|
import { ClientAbstract } from "./client_abstract.js";
|
|
5
6
|
import { Storage } from "../storage/storage.js";
|
|
6
7
|
import { DC, TransportProvider } from "../transport/transport_provider.js";
|
|
7
8
|
import { MessageEntity } from "../types/0_message_entity.js";
|
|
9
|
+
import { ReplyKeyboardRemove } from "../types/0_reply_keyboard_remove.js";
|
|
10
|
+
import { ForceReply } from "../types/0_force_reply.js";
|
|
11
|
+
import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
|
|
12
|
+
import { InlineKeyboardMarkup } from "../types/2_inline_keyboard_markup.js";
|
|
13
|
+
import { Message } from "../types/3_message.js";
|
|
14
|
+
export declare const getEntity: unique symbol;
|
|
8
15
|
export declare const restartAuth: unique symbol;
|
|
9
16
|
export declare enum ParseMode {
|
|
10
17
|
None = "none",
|
|
@@ -15,7 +22,7 @@ export interface AuthorizeUserParams<S = string> {
|
|
|
15
22
|
code: S | (() => MaybePromise<S>);
|
|
16
23
|
password: S | (() => MaybePromise<S>);
|
|
17
24
|
}
|
|
18
|
-
export type
|
|
25
|
+
export type UpdateHandler = null | ((client: Client, update: types.TypeUpdate) => MaybePromise<void>);
|
|
19
26
|
export interface ClientParams {
|
|
20
27
|
/**
|
|
21
28
|
* Default parse mode. Defauls to `ParseMode.None`.
|
|
@@ -59,7 +66,8 @@ export declare class Client extends ClientAbstract {
|
|
|
59
66
|
private state;
|
|
60
67
|
private promises;
|
|
61
68
|
private toAcknowledge;
|
|
62
|
-
|
|
69
|
+
private updateState?;
|
|
70
|
+
updateHandler: UpdateHandler;
|
|
63
71
|
readonly parseMode: ParseMode;
|
|
64
72
|
readonly appVersion: string;
|
|
65
73
|
readonly deviceModel: string;
|
|
@@ -91,6 +99,7 @@ export declare class Client extends ClientAbstract {
|
|
|
91
99
|
* Before establishing the connection, the session is saved.
|
|
92
100
|
*/
|
|
93
101
|
connect(): Promise<void>;
|
|
102
|
+
private fetchState;
|
|
94
103
|
/**
|
|
95
104
|
* Calls [initConnection](1) and authorizes the client with one of the following:
|
|
96
105
|
*
|
|
@@ -109,6 +118,7 @@ export declare class Client extends ClientAbstract {
|
|
|
109
118
|
* [2]: https://core.telegram.org/method/updates.getState
|
|
110
119
|
*/
|
|
111
120
|
authorize(params: string | types.AuthExportedAuthorization | AuthorizeUserParams): Promise<void>;
|
|
121
|
+
private messageProcessQueue;
|
|
112
122
|
private receiveLoop;
|
|
113
123
|
private pingLoop;
|
|
114
124
|
/**
|
|
@@ -125,8 +135,20 @@ export declare class Client extends ClientAbstract {
|
|
|
125
135
|
send<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<void>;
|
|
126
136
|
private processChats;
|
|
127
137
|
private processUsers;
|
|
138
|
+
private updateApplicationMutex;
|
|
139
|
+
private applyUpdateNoGap;
|
|
140
|
+
private applyUpdate;
|
|
128
141
|
private processUpdates;
|
|
142
|
+
private setUpdateStateDate;
|
|
143
|
+
private getLocalState;
|
|
144
|
+
private updateGapRecoveryMutex;
|
|
145
|
+
private recoverUpdateGap;
|
|
146
|
+
private recoverChannelUpdateGap;
|
|
129
147
|
getInputPeer(id: string | number): Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
|
|
148
|
+
[getEntity](peer: types.PeerUser): Promise<types.User | null>;
|
|
149
|
+
[getEntity](peer: types.PeerChat): Promise<types.Chat | null>;
|
|
150
|
+
[getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
|
|
151
|
+
processResult(result: ReadObject): Promise<void>;
|
|
130
152
|
sendMessage(chatId: number | string, text: string, params?: {
|
|
131
153
|
parseMode?: ParseMode;
|
|
132
154
|
entities?: MessageEntity[];
|
|
@@ -136,5 +158,8 @@ export declare class Client extends ClientAbstract {
|
|
|
136
158
|
replyToMessageId?: number;
|
|
137
159
|
messageThreadId?: number;
|
|
138
160
|
sendAs?: number | string;
|
|
139
|
-
|
|
161
|
+
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
162
|
+
}): Promise<Message>;
|
|
163
|
+
getMessages(chatId: number | string, messageIds: number[]): Promise<Message[]>;
|
|
164
|
+
getMessage(chatId: number | string, messageId: number): Promise<Message | null>;
|
|
140
165
|
}
|