@mtkruto/node 0.1.141 → 0.1.143
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 +1 -0
- package/esm/5_client.js +1 -0
- package/esm/client/0_types.d.ts +2 -0
- package/esm/client/1_bot_info_manager.d.ts +30 -0
- package/esm/client/1_bot_info_manager.js +66 -0
- package/esm/client/1_network_statistics_manager.d.ts +19 -0
- package/esm/client/1_network_statistics_manager.js +48 -0
- package/esm/client/1_reaction_manager.d.ts +9 -0
- package/esm/client/1_reaction_manager.js +84 -0
- package/esm/client/2_message_manager.d.ts +22 -2
- package/esm/client/2_message_manager.js +282 -28
- package/esm/client/3_callback_query_manager.d.ts +16 -0
- package/esm/client/3_callback_query_manager.js +36 -0
- package/esm/client/3_chat_list_manager.d.ts +5 -9
- package/esm/client/3_chat_list_manager.js +190 -103
- package/esm/client/3_inline_query_manager.d.ts +16 -0
- package/esm/client/3_inline_query_manager.js +49 -0
- package/esm/client/4_client.d.ts +12 -12
- package/esm/client/4_client.js +162 -538
- package/esm/client/5_session_string.d.ts +3 -0
- package/esm/client/5_session_string.js +22 -0
- package/esm/connection/1_connection_web_socket.js +1 -1
- 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 +1 -0
- package/script/5_client.js +1 -0
- package/script/client/0_types.d.ts +2 -0
- package/script/client/1_bot_info_manager.d.ts +30 -0
- package/script/client/1_bot_info_manager.js +70 -0
- package/script/client/1_network_statistics_manager.d.ts +19 -0
- package/script/client/1_network_statistics_manager.js +52 -0
- package/script/client/1_reaction_manager.d.ts +9 -0
- package/script/client/1_reaction_manager.js +88 -0
- package/script/client/2_message_manager.d.ts +22 -2
- package/script/client/2_message_manager.js +281 -27
- package/script/client/3_callback_query_manager.d.ts +16 -0
- package/script/client/3_callback_query_manager.js +40 -0
- package/script/client/3_chat_list_manager.d.ts +5 -9
- package/script/client/3_chat_list_manager.js +187 -100
- package/script/client/3_inline_query_manager.d.ts +16 -0
- package/script/client/3_inline_query_manager.js +53 -0
- package/script/client/4_client.d.ts +12 -12
- package/script/client/4_client.js +158 -534
- package/script/client/5_session_string.d.ts +3 -0
- package/script/client/5_session_string.js +27 -0
- package/script/connection/1_connection_web_socket.js +1 -1
- package/esm/client/3_reaction_manager.d.ts +0 -16
- package/esm/client/3_reaction_manager.js +0 -61
- package/script/client/3_reaction_manager.d.ts +0 -16
- package/script/client/3_reaction_manager.js +0 -65
package/esm/4_constants.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type PublicKeys = readonly [bigint, [bigint, bigint]][];
|
|
|
4
4
|
export declare const PUBLIC_KEYS: PublicKeys;
|
|
5
5
|
export declare const INITIAL_DC: DC;
|
|
6
6
|
export declare const LAYER = 169;
|
|
7
|
-
export declare const APP_VERSION = "MTKruto 0.1.
|
|
7
|
+
export declare const APP_VERSION = "MTKruto 0.1.143";
|
|
8
8
|
export declare const DEVICE_MODEL: string;
|
|
9
9
|
export declare const LANG_CODE: string;
|
|
10
10
|
export declare const LANG_PACK = "";
|
package/esm/4_constants.js
CHANGED
|
@@ -53,7 +53,7 @@ export const PUBLIC_KEYS = Object.freeze([
|
|
|
53
53
|
]);
|
|
54
54
|
export const INITIAL_DC = "2";
|
|
55
55
|
export const LAYER = 169;
|
|
56
|
-
export const APP_VERSION = "MTKruto 0.1.
|
|
56
|
+
export const APP_VERSION = "MTKruto 0.1.143";
|
|
57
57
|
// @ts-ignore: lib
|
|
58
58
|
export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
59
59
|
export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
package/esm/5_client.d.ts
CHANGED
package/esm/5_client.js
CHANGED
package/esm/client/0_types.d.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BotCommand } from "../3_types.js";
|
|
2
|
+
import { GetMyCommandsParams, SetMyCommandsParams } from "./0_params.js";
|
|
3
|
+
import { C } from "./0_types.js";
|
|
4
|
+
export declare class BotInfoManager {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(c: C);
|
|
7
|
+
setMyDescription(params?: {
|
|
8
|
+
description?: string;
|
|
9
|
+
languageCode?: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
setMyName(params?: {
|
|
12
|
+
name?: string;
|
|
13
|
+
languageCode?: string;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
setMyShortDescription(params?: {
|
|
16
|
+
shortDescription?: string;
|
|
17
|
+
languageCode?: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
getMyDescription(params?: {
|
|
20
|
+
languageCode?: string;
|
|
21
|
+
}): Promise<string>;
|
|
22
|
+
getMyName(params?: {
|
|
23
|
+
languageCode?: string;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
getMyShortDescription(params?: {
|
|
26
|
+
languageCode?: string;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
getMyCommands(params?: GetMyCommandsParams): Promise<BotCommand[]>;
|
|
29
|
+
setMyCommands(commands: BotCommand[], params?: SetMyCommandsParams): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _BotInfoManager_instances, _BotInfoManager_c, _BotInfoManager_setMyInfo, _BotInfoManager_getMyInfo;
|
|
13
|
+
import { types } from "../2_tl.js";
|
|
14
|
+
import { botCommandScopeToTlObject } from "../3_types.js";
|
|
15
|
+
export class BotInfoManager {
|
|
16
|
+
constructor(c) {
|
|
17
|
+
_BotInfoManager_instances.add(this);
|
|
18
|
+
_BotInfoManager_c.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _BotInfoManager_c, c, "f");
|
|
20
|
+
}
|
|
21
|
+
async setMyDescription(params) {
|
|
22
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyDescription");
|
|
23
|
+
await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { description: params?.description, lang_code: params?.languageCode ?? "" });
|
|
24
|
+
}
|
|
25
|
+
async setMyName(params) {
|
|
26
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyName");
|
|
27
|
+
await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { name: params?.name, lang_code: params?.languageCode ?? "" });
|
|
28
|
+
}
|
|
29
|
+
async setMyShortDescription(params) {
|
|
30
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyShortDescription");
|
|
31
|
+
await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { about: params?.shortDescription, lang_code: params?.languageCode ?? "" });
|
|
32
|
+
}
|
|
33
|
+
async getMyDescription(params) {
|
|
34
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyDescription");
|
|
35
|
+
return await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode).then((v) => v.description);
|
|
36
|
+
}
|
|
37
|
+
async getMyName(params) {
|
|
38
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyName");
|
|
39
|
+
return await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode).then((v) => v.description);
|
|
40
|
+
}
|
|
41
|
+
async getMyShortDescription(params) {
|
|
42
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyShortDescription");
|
|
43
|
+
return await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode).then((v) => v.about);
|
|
44
|
+
}
|
|
45
|
+
async getMyCommands(params) {
|
|
46
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyCommands");
|
|
47
|
+
const commands_ = await __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.getBotCommands({
|
|
48
|
+
lang_code: params?.languageCode ?? "",
|
|
49
|
+
scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, __classPrivateFieldGet(this, _BotInfoManager_c, "f").getInputPeer),
|
|
50
|
+
});
|
|
51
|
+
return commands_.map((v) => ({ command: v.command, description: v.description }));
|
|
52
|
+
}
|
|
53
|
+
async setMyCommands(commands, params) {
|
|
54
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyCommands");
|
|
55
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.setBotCommands({
|
|
56
|
+
commands: commands.map((v) => new types.BotCommand(v)),
|
|
57
|
+
lang_code: params?.languageCode ?? "",
|
|
58
|
+
scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, __classPrivateFieldGet(this, _BotInfoManager_c, "f").getInputPeer),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_BotInfoManager_c = new WeakMap(), _BotInfoManager_instances = new WeakSet(), _BotInfoManager_setMyInfo = async function _BotInfoManager_setMyInfo(info) {
|
|
63
|
+
await __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.setBotInfo({ bot: new types.InputUserSelf(), ...info });
|
|
64
|
+
}, _BotInfoManager_getMyInfo = function _BotInfoManager_getMyInfo(languageCode) {
|
|
65
|
+
return __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.getBotInfo({ bot: new types.InputUserSelf(), lang_code: languageCode ?? "" });
|
|
66
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { C } from "./0_types.js";
|
|
2
|
+
export declare class NetworkStatisticsManager {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(c: C);
|
|
5
|
+
getNetworkStatistics(): Promise<{
|
|
6
|
+
messages: {
|
|
7
|
+
sent: number;
|
|
8
|
+
received: number;
|
|
9
|
+
};
|
|
10
|
+
cdn: {
|
|
11
|
+
sent: number;
|
|
12
|
+
received: number;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
getTransportReadWriteCallback(): {
|
|
16
|
+
read: (count: number) => Promise<void>;
|
|
17
|
+
write: (count: number) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _NetworkStatisticsManager_c;
|
|
13
|
+
export class NetworkStatisticsManager {
|
|
14
|
+
constructor(c) {
|
|
15
|
+
_NetworkStatisticsManager_c.set(this, void 0);
|
|
16
|
+
__classPrivateFieldSet(this, _NetworkStatisticsManager_c, c, "f");
|
|
17
|
+
}
|
|
18
|
+
async getNetworkStatistics() {
|
|
19
|
+
const [messagesRead, messagesWrite, cdnRead, cdnWrite] = await Promise.all([
|
|
20
|
+
__classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_messages_read"]),
|
|
21
|
+
__classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_messages_write"]),
|
|
22
|
+
__classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_cdn_read"]),
|
|
23
|
+
__classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_cdn_write"]),
|
|
24
|
+
]);
|
|
25
|
+
const messages = {
|
|
26
|
+
sent: Number(messagesWrite || 0),
|
|
27
|
+
received: Number(messagesRead || 0),
|
|
28
|
+
};
|
|
29
|
+
const cdn = {
|
|
30
|
+
sent: Number(cdnWrite || 0),
|
|
31
|
+
received: Number(cdnRead || 0),
|
|
32
|
+
};
|
|
33
|
+
return { messages, cdn };
|
|
34
|
+
}
|
|
35
|
+
getTransportReadWriteCallback() {
|
|
36
|
+
return {
|
|
37
|
+
read: async (count) => {
|
|
38
|
+
const key = __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").cdn ? "netstat_cdn_read" : "netstat_messages_read";
|
|
39
|
+
await __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.incr([key], count);
|
|
40
|
+
},
|
|
41
|
+
write: async (count) => {
|
|
42
|
+
const key = __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").cdn ? "netstat_cdn_write" : "netstat_messages_write";
|
|
43
|
+
await __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.incr([key], count);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
_NetworkStatisticsManager_c = new WeakMap();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { enums, types } from "../2_tl.js";
|
|
2
|
+
import { Update } from "../3_types.js";
|
|
3
|
+
import { C } from "./0_types.js";
|
|
4
|
+
export declare class ReactionManager {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(c: C);
|
|
7
|
+
static canHandleUpdate(update: enums.Update): update is types.UpdateBotMessageReactions | types.UpdateBotMessageReaction | types.UpdateMessageReactions | types.UpdateChannelMessageViews | types.UpdateChannelMessageForwards;
|
|
8
|
+
handleUpdate(update: types.UpdateBotMessageReactions | types.UpdateBotMessageReaction | types.UpdateMessageReactions | types.UpdateChannelMessageViews | types.UpdateChannelMessageForwards): Promise<Update | null>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _ReactionManager_c;
|
|
13
|
+
import { UNREACHABLE } from "../1_utilities.js";
|
|
14
|
+
import { peerToChatId, types } from "../2_tl.js";
|
|
15
|
+
import { constructMessageReaction, constructMessageReactionCount, constructMessageReactions } from "../3_types.js";
|
|
16
|
+
export class ReactionManager {
|
|
17
|
+
constructor(c) {
|
|
18
|
+
_ReactionManager_c.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _ReactionManager_c, c, "f");
|
|
20
|
+
}
|
|
21
|
+
static canHandleUpdate(update) {
|
|
22
|
+
return update instanceof types.UpdateBotMessageReactions || update instanceof types.UpdateBotMessageReaction || update instanceof types.UpdateMessageReactions || update instanceof types.UpdateChannelMessageViews || update instanceof types.UpdateChannelMessageForwards;
|
|
23
|
+
}
|
|
24
|
+
async handleUpdate(update) {
|
|
25
|
+
if (update instanceof types.UpdateBotMessageReactions) {
|
|
26
|
+
const messageReactionCount = await constructMessageReactionCount(update, __classPrivateFieldGet(this, _ReactionManager_c, "f").getEntity);
|
|
27
|
+
if (messageReactionCount) {
|
|
28
|
+
return { messageReactionCount };
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (update instanceof types.UpdateBotMessageReaction) {
|
|
35
|
+
const messageReactions = await constructMessageReactions(update, __classPrivateFieldGet(this, _ReactionManager_c, "f").getEntity);
|
|
36
|
+
if (messageReactions) {
|
|
37
|
+
return { messageReactions };
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (update instanceof types.UpdateMessageReactions) {
|
|
44
|
+
const chatId = peerToChatId(update.peer);
|
|
45
|
+
const message = await __classPrivateFieldGet(this, _ReactionManager_c, "f").storage.getMessage(chatId, update.msg_id);
|
|
46
|
+
if (message instanceof types.Message) {
|
|
47
|
+
message.reactions = update.reactions;
|
|
48
|
+
await __classPrivateFieldGet(this, _ReactionManager_c, "f").storage.setMessage(chatId, update.msg_id, message);
|
|
49
|
+
const views = message.views ?? 0;
|
|
50
|
+
const forwards = message.forwards ?? 0;
|
|
51
|
+
const recentReactions = update.reactions.recent_reactions ?? [];
|
|
52
|
+
const reactions = update.reactions.results.map((v) => constructMessageReaction(v, recentReactions));
|
|
53
|
+
return ({ messageInteractions: { chatId, messageId: update.msg_id, reactions, views, forwards } });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (update instanceof types.UpdateChannelMessageViews || update instanceof types.UpdateChannelMessageForwards) {
|
|
60
|
+
const chatId = peerToChatId(new types.PeerChannel(update));
|
|
61
|
+
const message = await __classPrivateFieldGet(this, _ReactionManager_c, "f").storage.getMessage(chatId, update.id);
|
|
62
|
+
if (message instanceof types.Message) {
|
|
63
|
+
if ("views" in update) {
|
|
64
|
+
message.views = update.views;
|
|
65
|
+
}
|
|
66
|
+
if ("forwards" in update) {
|
|
67
|
+
message.forwards = update.forwards;
|
|
68
|
+
}
|
|
69
|
+
const views = message.views ?? 0;
|
|
70
|
+
const forwards = message.forwards ?? 0;
|
|
71
|
+
const recentReactions = message.reactions?.recent_reactions ?? [];
|
|
72
|
+
const reactions = message.reactions?.results.map((v) => constructMessageReaction(v, recentReactions)) ?? [];
|
|
73
|
+
return { messageInteractions: { chatId, messageId: update.id, reactions, views, forwards } };
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
UNREACHABLE();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
_ReactionManager_c = new WeakMap();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { enums, types } from "../2_tl.js";
|
|
2
|
-
import { FileSource, ID, Message } from "../3_types.js";
|
|
3
|
-
import { DeleteMessagesParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetHistoryParams, PinMessageParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams } from "./0_params.js";
|
|
2
|
+
import { ChatAction, FileSource, ID, Message, MessageEntity, ParseMode, Reaction, Update, UsernameResolver } from "../3_types.js";
|
|
3
|
+
import { BanChatMemberParams, DeleteMessagesParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetHistoryParams, PinMessageParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams } from "./0_params.js";
|
|
4
|
+
import { AddReactionParams, SetReactionsParams } from "./0_params.js";
|
|
4
5
|
import { C as C_ } from "./0_types.js";
|
|
5
6
|
import { FileManager } from "./1_file_manager.js";
|
|
6
7
|
interface C extends C_ {
|
|
@@ -12,10 +13,15 @@ export declare class MessageManager {
|
|
|
12
13
|
getMessages(chatId: ID, messageIds: number[]): Promise<Message[]>;
|
|
13
14
|
getMessageWithReply(chatId: ID, messageId: number): Promise<Message>;
|
|
14
15
|
getMessage(chatId: ID, messageId: number): Promise<Message>;
|
|
16
|
+
parseText(text: string, params?: {
|
|
17
|
+
parseMode?: ParseMode;
|
|
18
|
+
entities?: MessageEntity[];
|
|
19
|
+
}): readonly [string, (import("../tl/2_types.js").MessageEntityMention_ | import("../tl/2_types.js").MessageEntityHashtag_ | import("../tl/2_types.js").MessageEntityBotCommand_ | import("../tl/2_types.js").MessageEntityUrl_ | import("../tl/2_types.js").MessageEntityEmail_ | import("../tl/2_types.js").MessageEntityBold_ | import("../tl/2_types.js").MessageEntityItalic_ | import("../tl/2_types.js").MessageEntityCode_ | import("../tl/2_types.js").MessageEntityPre_ | import("../tl/2_types.js").MessageEntityTextUrl_ | import("../tl/2_types.js").MessageEntityMentionName_ | import("../tl/2_types.js").MessageEntityPhone_ | import("../tl/2_types.js").MessageEntityCashtag_ | import("../tl/2_types.js").MessageEntityUnderline_ | import("../tl/2_types.js").MessageEntityStrike_ | import("../tl/2_types.js").MessageEntityBankCard_ | import("../tl/2_types.js").MessageEntitySpoiler_ | import("../tl/2_types.js").MessageEntityCustomEmoji_ | import("../tl/2_types.js").MessageEntityBlockquote_)[] | undefined];
|
|
15
20
|
getStickerSetName(inputStickerSet: types.InputStickerSetID, hash?: number): Promise<string>;
|
|
16
21
|
constructMessage(message_: enums.Message, r?: boolean): Promise<Message>;
|
|
17
22
|
forwardMessages(from: ID, to: ID, messageIds: number[], params?: ForwardMessagesParams): Promise<Message[]>;
|
|
18
23
|
getHistory(chatId: ID, params?: GetHistoryParams): Promise<Message[]>;
|
|
24
|
+
usernameResolver: UsernameResolver;
|
|
19
25
|
sendMessage(chatId: ID, text: string, params?: SendMessageParams): Promise<import("../3_types.js").MessageText>;
|
|
20
26
|
sendVenue(chatId: ID, latitude: number, longitude: number, title: string, address: string, params?: SendVenueParams): Promise<import("../3_types.js").MessageVenue>;
|
|
21
27
|
sendContact(chatId: ID, firstName: string, number: string, params?: SendContactParams): Promise<import("../3_types.js").MessageContact>;
|
|
@@ -36,5 +42,19 @@ export declare class MessageManager {
|
|
|
36
42
|
pinMessage(chatId: ID, messageId: number, params?: PinMessageParams): Promise<void>;
|
|
37
43
|
unpinMessage(chatId: ID, messageId: number): Promise<void>;
|
|
38
44
|
unpinMessages(chatId: ID): Promise<void>;
|
|
45
|
+
setAvailableReactions(chatId: ID, availableReactions: "none" | "all" | Reaction[]): Promise<void>;
|
|
46
|
+
setReactions(chatId: number, messageId: number, reactions: Reaction[], params?: SetReactionsParams): Promise<void>;
|
|
47
|
+
addReaction(chatId: number, messageId: number, reaction: Reaction, params?: AddReactionParams): Promise<void>;
|
|
48
|
+
removeReaction(chatId: number, messageId: number, reaction: Reaction): Promise<void>;
|
|
49
|
+
static canHandleUpdate(update: enums.Update): update is types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages;
|
|
50
|
+
handleUpdate(update: types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages): Promise<Update | null>;
|
|
51
|
+
sendChatAction(chatId: ID, action: ChatAction, params?: {
|
|
52
|
+
messageThreadId?: number;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
deleteChatPhoto(chatId: number): Promise<void>;
|
|
55
|
+
setChatPhoto(chatId: number, photo: FileSource, params?: SetChatPhotoParams): Promise<void>;
|
|
56
|
+
banChatMember(chatId: ID, memberId: ID, params?: BanChatMemberParams): Promise<void>;
|
|
57
|
+
unbanChatMember(chatId: ID, memberId: ID): Promise<void>;
|
|
58
|
+
setChatMemberRights(chatId: ID, memberId: ID, params?: SetChatMemberRightsParams): Promise<void>;
|
|
39
59
|
}
|
|
40
60
|
export {};
|