@mtkruto/node 0.50.1 → 0.60.0
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/3_types.d.ts +1 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +1 -0
- package/esm/client/0_params.d.ts +12 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts +1 -0
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +51 -50
- package/esm/client/4_forum_manager.d.ts +40 -0
- package/esm/client/4_forum_manager.d.ts.map +1 -0
- package/esm/client/4_forum_manager.js +134 -0
- package/esm/client/5_client.d.ts +67 -2
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +87 -2
- package/esm/types/4_message.d.ts +3 -3
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +16 -8
- package/esm/types/5_topic.d.ts +34 -0
- package/esm/types/5_topic.d.ts.map +1 -0
- package/esm/types/5_topic.js +76 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +1 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +1 -0
- package/script/client/0_params.d.ts +12 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts +1 -0
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +51 -50
- package/script/client/4_forum_manager.d.ts +40 -0
- package/script/client/4_forum_manager.d.ts.map +1 -0
- package/script/client/4_forum_manager.js +138 -0
- package/script/client/5_client.d.ts +67 -2
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +87 -2
- package/script/types/4_message.d.ts +3 -3
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +16 -8
- package/script/types/5_topic.d.ts +34 -0
- package/script/types/5_topic.d.ts.map +1 -0
- package/script/types/5_topic.js +79 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.constructTopic = constructTopic;
|
|
23
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
24
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
25
|
+
function constructTopic(message) {
|
|
26
|
+
let forumTopicCreated;
|
|
27
|
+
let forumTopicEdited;
|
|
28
|
+
if ("forumTopicCreated" in message) {
|
|
29
|
+
forumTopicCreated = message;
|
|
30
|
+
}
|
|
31
|
+
else if (message.replyToMessage && "forumTopicCreated" in message.replyToMessage) {
|
|
32
|
+
forumTopicCreated = message.replyToMessage;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
(0, _0_deps_js_1.unreachable)();
|
|
36
|
+
}
|
|
37
|
+
if ("forumTopicEdited" in message) {
|
|
38
|
+
forumTopicEdited = message;
|
|
39
|
+
}
|
|
40
|
+
const id = forumTopicCreated.id;
|
|
41
|
+
const date = forumTopicCreated.date;
|
|
42
|
+
const creator = forumTopicCreated.from ? constructChatP(forumTopicCreated.from) : message.senderChat;
|
|
43
|
+
const general = forumTopicCreated.id == 1;
|
|
44
|
+
const closed = false;
|
|
45
|
+
const hidden = false;
|
|
46
|
+
let name = forumTopicCreated.forumTopicCreated.name;
|
|
47
|
+
const color = forumTopicCreated.forumTopicCreated.color;
|
|
48
|
+
let customEmoijId = forumTopicCreated.forumTopicCreated.customEmojiId;
|
|
49
|
+
if (forumTopicEdited) {
|
|
50
|
+
name = forumTopicEdited.forumTopicEdited.name;
|
|
51
|
+
customEmoijId = forumTopicEdited.forumTopicEdited.customEmojiId;
|
|
52
|
+
}
|
|
53
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
54
|
+
id,
|
|
55
|
+
date,
|
|
56
|
+
creator: creator,
|
|
57
|
+
general,
|
|
58
|
+
closed,
|
|
59
|
+
hidden,
|
|
60
|
+
name,
|
|
61
|
+
color,
|
|
62
|
+
customEmoijId,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function constructChatP(user) {
|
|
66
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
67
|
+
id: user.id,
|
|
68
|
+
type: "private",
|
|
69
|
+
color: user.color,
|
|
70
|
+
firstName: user.firstName,
|
|
71
|
+
lastName: user.lastName,
|
|
72
|
+
username: user.username,
|
|
73
|
+
also: user.also,
|
|
74
|
+
isScam: user.isScam,
|
|
75
|
+
isFake: user.isFake,
|
|
76
|
+
isSupport: user.isSupport,
|
|
77
|
+
isVerified: user.isVerified,
|
|
78
|
+
});
|
|
79
|
+
}
|