@mtkruto/node 0.154.0 → 0.161.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 +3 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +3 -0
- package/esm/client/0_markdown.js +4 -4
- package/esm/client/0_params.d.ts +11 -1
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +100 -3
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_client_encrypted.d.ts.map +1 -1
- package/esm/client/2_client_encrypted.js +12 -2
- package/esm/client/2_file_manager.js +1 -1
- package/esm/client/2_payment_manager.js +2 -2
- package/esm/client/2_takeout_manager.js +2 -2
- package/esm/client/2_update_manager.js +10 -10
- package/esm/client/3_account_manager.js +3 -3
- package/esm/client/3_message_manager.d.ts +11 -0
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +195 -74
- package/esm/client/3_sticker_set_manager.js +3 -3
- package/esm/client/3_video_chat_manager.js +1 -1
- package/esm/client/4_callback_query_manager.js +2 -2
- package/esm/client/4_chat_list_manager.js +3 -3
- package/esm/client/4_chat_manager.d.ts +3 -2
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +12 -5
- package/esm/client/4_contact_manager.js +1 -1
- package/esm/client/4_gift_manager.js +11 -11
- package/esm/client/4_inline_query_manager.js +1 -1
- package/esm/client/4_story_manager.d.ts +3 -1
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +17 -3
- package/esm/client/6_client.d.ts +100 -3
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +126 -1
- package/esm/client/6_client_dispatcher.d.ts +100 -3
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +126 -1
- package/esm/connection/0_get_tls_header.d.ts.map +1 -1
- package/esm/connection/0_get_tls_header.js +19 -0
- package/esm/connection/1_connection_web_socket.js +2 -2
- package/esm/session/2_session_encrypted.js +2 -2
- package/esm/storage/1_utilities.js +2 -2
- package/esm/transport/2_transport_provider_web_socket.js +1 -1
- package/esm/types/0_button_style.js +1 -1
- package/esm/types/0_chat_member_rights.js +34 -34
- package/esm/types/0_chat_photo.js +2 -2
- package/esm/types/0_dice.d.ts +1 -1
- package/esm/types/0_dice.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.js +1 -1
- package/esm/types/0_live_stream_channel.d.ts +1 -1
- package/esm/types/0_live_stream_channel.d.ts.map +1 -1
- package/esm/types/0_report_reason.d.ts +63 -0
- package/esm/types/0_report_reason.d.ts.map +1 -0
- package/esm/types/0_report_reason.js +45 -0
- package/esm/types/0_story_report_option.d.ts +26 -0
- package/esm/types/0_story_report_option.d.ts.map +1 -0
- package/esm/types/0_story_report_option.js +25 -0
- package/esm/types/0_video_chat.js +2 -2
- package/esm/types/1_inline_keyboard_button.d.ts +2 -2
- package/esm/types/1_message_reaction.js +1 -1
- package/esm/types/1_sticker.js +1 -1
- package/esm/types/1_story_reaction.js +1 -1
- package/esm/types/1_story_report_result.d.ts +40 -0
- package/esm/types/1_story_report_result.d.ts.map +1 -0
- package/esm/types/1_story_report_result.js +36 -0
- package/esm/types/2_chat.js +2 -2
- package/esm/types/2_chat_member.js +3 -3
- package/esm/types/2_message_entity.js +1 -1
- package/esm/types/2_story_interactive_area.js +3 -3
- package/esm/types/3_chat_settings.js +1 -1
- package/esm/types/3_forward_header.js +3 -3
- package/esm/types/3_inline_query.js +1 -1
- package/esm/types/3_invite_link.js +2 -2
- package/esm/types/3_story.js +3 -3
- package/esm/types/4_gift.js +1 -1
- package/esm/types/5_gift_non_upgraded_information.js +8 -8
- package/esm/types/5_gift_upgraded_information.js +5 -5
- package/esm/types/6_poll_media.d.ts +1 -1
- package/esm/types/6_poll_media.d.ts.map +1 -1
- package/esm/types/7_inline_query_result.js +8 -8
- package/esm/types/7_poll_option.d.ts +1 -1
- package/esm/types/7_poll_option.d.ts.map +1 -1
- package/esm/types/8_inline_query_answer.js +1 -1
- package/esm/types/9_message.js +3 -3
- package/esm/utilities/0_env.js +1 -1
- package/package.json +1 -1
- package/script/3_types.d.ts +3 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +3 -0
- package/script/client/0_markdown.js +4 -4
- package/script/client/0_params.d.ts +11 -1
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +100 -3
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_client_encrypted.d.ts.map +1 -1
- package/script/client/2_client_encrypted.js +12 -2
- package/script/client/2_file_manager.js +1 -1
- package/script/client/2_payment_manager.js +2 -2
- package/script/client/2_takeout_manager.js +2 -2
- package/script/client/2_update_manager.js +10 -10
- package/script/client/3_account_manager.js +3 -3
- package/script/client/3_message_manager.d.ts +11 -0
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +194 -73
- package/script/client/3_sticker_set_manager.js +3 -3
- package/script/client/3_video_chat_manager.js +1 -1
- package/script/client/4_callback_query_manager.js +2 -2
- package/script/client/4_chat_list_manager.js +3 -3
- package/script/client/4_chat_manager.d.ts +3 -2
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +11 -4
- package/script/client/4_contact_manager.js +1 -1
- package/script/client/4_gift_manager.js +11 -11
- package/script/client/4_inline_query_manager.js +1 -1
- package/script/client/4_story_manager.d.ts +3 -1
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +15 -1
- package/script/client/6_client.d.ts +100 -3
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +126 -1
- package/script/client/6_client_dispatcher.d.ts +100 -3
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +126 -1
- package/script/connection/0_get_tls_header.d.ts.map +1 -1
- package/script/connection/0_get_tls_header.js +19 -0
- package/script/connection/1_connection_web_socket.js +2 -2
- package/script/session/2_session_encrypted.js +2 -2
- package/script/storage/1_utilities.js +2 -2
- package/script/transport/2_transport_provider_web_socket.js +1 -1
- package/script/types/0_button_style.js +1 -1
- package/script/types/0_chat_member_rights.js +34 -34
- package/script/types/0_chat_photo.js +2 -2
- package/script/types/0_dice.d.ts +1 -1
- package/script/types/0_dice.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.js +1 -1
- package/script/types/0_live_stream_channel.d.ts +1 -1
- package/script/types/0_live_stream_channel.d.ts.map +1 -1
- package/script/types/0_report_reason.d.ts +63 -0
- package/script/types/0_report_reason.d.ts.map +1 -0
- package/script/types/0_report_reason.js +48 -0
- package/script/types/0_story_report_option.d.ts +26 -0
- package/script/types/0_story_report_option.d.ts.map +1 -0
- package/script/types/0_story_report_option.js +28 -0
- package/script/types/0_video_chat.js +2 -2
- package/script/types/1_inline_keyboard_button.d.ts +2 -2
- package/script/types/1_message_reaction.js +1 -1
- package/script/types/1_sticker.js +1 -1
- package/script/types/1_story_reaction.js +1 -1
- package/script/types/1_story_report_result.d.ts +40 -0
- package/script/types/1_story_report_result.d.ts.map +1 -0
- package/script/types/1_story_report_result.js +39 -0
- package/script/types/2_chat.js +2 -2
- package/script/types/2_chat_member.js +3 -3
- package/script/types/2_message_entity.js +1 -1
- package/script/types/2_story_interactive_area.js +3 -3
- package/script/types/3_chat_settings.js +1 -1
- package/script/types/3_forward_header.js +3 -3
- package/script/types/3_inline_query.js +1 -1
- package/script/types/3_invite_link.js +2 -2
- package/script/types/3_story.js +3 -3
- package/script/types/4_gift.js +1 -1
- package/script/types/5_gift_non_upgraded_information.js +8 -8
- package/script/types/5_gift_upgraded_information.js +5 -5
- package/script/types/6_poll_media.d.ts +1 -1
- package/script/types/6_poll_media.d.ts.map +1 -1
- package/script/types/7_inline_query_result.js +8 -8
- package/script/types/7_poll_option.d.ts +1 -1
- package/script/types/7_poll_option.d.ts.map +1 -1
- package/script/types/8_inline_query_answer.js +1 -1
- package/script/types/9_message.js +3 -3
- package/script/utilities/0_env.js +1 -1
|
@@ -54,7 +54,7 @@ export class ConnectionWebSocket {
|
|
|
54
54
|
const unlock = await mutex.lock();
|
|
55
55
|
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : unreachable())).arrayBuffer());
|
|
56
56
|
this.#buffer = concat([this.#buffer, data]);
|
|
57
|
-
if (this.#nextResolve !== null && this.#buffer.
|
|
57
|
+
if (this.#nextResolve !== null && this.#buffer.byteLength >= this.#nextResolve[0]) {
|
|
58
58
|
this.#nextResolve[1].resolve();
|
|
59
59
|
this.#nextResolve = null;
|
|
60
60
|
}
|
|
@@ -96,7 +96,7 @@ export class ConnectionWebSocket {
|
|
|
96
96
|
const unlock = await this.#rMutex.lock();
|
|
97
97
|
try {
|
|
98
98
|
this.#assertConnected();
|
|
99
|
-
if (this.#buffer.
|
|
99
|
+
if (this.#buffer.byteLength < p.byteLength) {
|
|
100
100
|
await new Promise((resolve, reject) => this.#nextResolve = [p.byteLength, { resolve, reject }]);
|
|
101
101
|
}
|
|
102
102
|
const slice = this.#buffer.slice(0, p.byteLength);
|
|
@@ -184,7 +184,7 @@ export class SessionEncrypted extends Session {
|
|
|
184
184
|
payloadWriter.writeInt64(this.state.serverSalt);
|
|
185
185
|
payloadWriter.writeInt64(this.#id);
|
|
186
186
|
payloadWriter.write(await serializeMessage(message));
|
|
187
|
-
payloadWriter.write(new Uint8Array(mod(-(payloadWriter.buffer.
|
|
187
|
+
payloadWriter.write(new Uint8Array(mod(-(payloadWriter.buffer.byteLength + 12), 16) + 12));
|
|
188
188
|
const payload = payloadWriter.buffer;
|
|
189
189
|
const messageKey = (await sha256(concat([this.#authKey.subarray(88, 120), payload]))).subarray(8, 24);
|
|
190
190
|
const a = await sha256(concat([messageKey, this.#authKey.subarray(0, 36)]));
|
|
@@ -330,7 +330,7 @@ export class SessionEncrypted extends Session {
|
|
|
330
330
|
//// RECEIVE LOOP HANDLERS ////
|
|
331
331
|
async #onMessage(msgId, body, containerId) {
|
|
332
332
|
this.#LreceiveLoop.debug("received message with ID", msgId, "and size", body.byteLength, "inside", ...(containerId === null ? ["no container"] : ["container", containerId]));
|
|
333
|
-
const logger = this.#LreceiveLoop.branch(msgId
|
|
333
|
+
const logger = this.#LreceiveLoop.branch(String(msgId));
|
|
334
334
|
let reader = new TLReader(body);
|
|
335
335
|
let id = reader.readInt32(false);
|
|
336
336
|
if (id === GZIP_PACKED) {
|
|
@@ -67,7 +67,7 @@ export function fromString(string) {
|
|
|
67
67
|
const [type, value] = [Number(string[0]), string.slice(1)];
|
|
68
68
|
switch (type) {
|
|
69
69
|
case ValueType.Boolean:
|
|
70
|
-
return
|
|
70
|
+
return !!Number(value);
|
|
71
71
|
case ValueType.Number:
|
|
72
72
|
return Number(value);
|
|
73
73
|
case ValueType.String:
|
|
@@ -91,7 +91,7 @@ export function fromString(string) {
|
|
|
91
91
|
return arr;
|
|
92
92
|
}
|
|
93
93
|
case ValueType.Map:
|
|
94
|
-
//deno-lint-ignore no-explicit-any
|
|
94
|
+
// deno-lint-ignore no-explicit-any
|
|
95
95
|
return Object.fromEntries(fromString(`${ValueType.Array}${value}`));
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -33,7 +33,7 @@ const dcToNameMap = {
|
|
|
33
33
|
export const transportProviderWebSocket = (params) => {
|
|
34
34
|
return ({ dc, isMedia }) => {
|
|
35
35
|
params ??= {};
|
|
36
|
-
params.wss ??= typeof location !== "undefined" && location.protocol === "http:" && location.hostname !== "localhost"
|
|
36
|
+
params.wss ??= !(typeof location !== "undefined" && location.protocol === "http:" && location.hostname !== "localhost");
|
|
37
37
|
const url = `${params.wss ? "wss" : "ws"}://${dcToNameMap[dc]}${isMedia ? "-1" : ""}.web.telegram.org/${dc.endsWith("-test") ? "apiws_test" : "apiws"}`;
|
|
38
38
|
const connection = new ConnectionWebSocket(url);
|
|
39
39
|
const dcId = getDcId(dc, isMedia);
|
|
@@ -32,5 +32,5 @@ export function buttonStyleToTlObject(buttonStyle) {
|
|
|
32
32
|
if (buttonStyle === undefined) {
|
|
33
33
|
return undefined;
|
|
34
34
|
}
|
|
35
|
-
return { _: "keyboardButtonStyle", bg_danger: buttonStyle.background === "danger"
|
|
35
|
+
return { _: "keyboardButtonStyle", bg_danger: buttonStyle.background === "danger" || undefined, bg_primary: buttonStyle.background === "primary" || undefined, bg_success: buttonStyle.background === "success" || undefined, icon: buttonStyle.customEmojiId ? BigInt(buttonStyle.customEmojiId) : undefined };
|
|
36
36
|
}
|
|
@@ -20,45 +20,45 @@
|
|
|
20
20
|
import { cleanObject } from "../1_utilities.js";
|
|
21
21
|
export function constructChatMemberRights(rights) {
|
|
22
22
|
return cleanObject({
|
|
23
|
-
canSendMessages: rights.send_messages
|
|
24
|
-
canSendAudio: rights.send_audios
|
|
25
|
-
canSendDocuments: rights.send_docs
|
|
26
|
-
canSendPhotos: rights.send_photos
|
|
27
|
-
canSendVideos: rights.send_messages
|
|
28
|
-
canSendVideoNotes: rights.send_roundvideos
|
|
29
|
-
canSendVoice: rights.send_voices
|
|
30
|
-
canSendPolls: rights.send_polls
|
|
31
|
-
canSendStickers: rights.send_stickers
|
|
32
|
-
canSendAnimations: rights.send_gifs
|
|
33
|
-
canSendGames: rights.send_games
|
|
34
|
-
canSendInlineBotResults: rights.send_inline
|
|
35
|
-
canAddWebPagePreviews: rights.embed_links
|
|
36
|
-
canChangeInfo: rights.change_info
|
|
37
|
-
canInviteUsers: rights.invite_users
|
|
38
|
-
canPinMessages: rights.pin_messages
|
|
39
|
-
canManageTopics: rights.manage_topics
|
|
23
|
+
canSendMessages: !!rights.send_messages,
|
|
24
|
+
canSendAudio: !!rights.send_audios,
|
|
25
|
+
canSendDocuments: !!rights.send_docs,
|
|
26
|
+
canSendPhotos: !!rights.send_photos,
|
|
27
|
+
canSendVideos: !!rights.send_messages,
|
|
28
|
+
canSendVideoNotes: !!rights.send_roundvideos,
|
|
29
|
+
canSendVoice: !!rights.send_voices,
|
|
30
|
+
canSendPolls: !!rights.send_polls,
|
|
31
|
+
canSendStickers: !!rights.send_stickers,
|
|
32
|
+
canSendAnimations: rights.send_gifs || undefined,
|
|
33
|
+
canSendGames: rights.send_games || undefined,
|
|
34
|
+
canSendInlineBotResults: rights.send_inline || undefined,
|
|
35
|
+
canAddWebPagePreviews: rights.embed_links || undefined,
|
|
36
|
+
canChangeInfo: rights.change_info || undefined,
|
|
37
|
+
canInviteUsers: rights.invite_users || undefined,
|
|
38
|
+
canPinMessages: rights.pin_messages || undefined,
|
|
39
|
+
canManageTopics: rights.manage_topics || undefined,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
export function chatMemberRightsToTlObject(rights, until) {
|
|
43
43
|
return {
|
|
44
44
|
_: "chatBannedRights",
|
|
45
45
|
until_date: until ?? 0,
|
|
46
|
-
send_messages: rights?.canSendMessages
|
|
47
|
-
send_audios: rights?.canSendAudio
|
|
48
|
-
send_docs: rights?.canSendDocuments
|
|
49
|
-
send_photos: rights?.canSendPhotos
|
|
50
|
-
send_videos: rights?.canSendVideos
|
|
51
|
-
send_roundvideos: rights?.canSendVideoNotes
|
|
52
|
-
send_voices: rights?.canSendVoice
|
|
53
|
-
send_polls: rights?.canSendPolls
|
|
54
|
-
send_stickers: rights?.canSendStickers
|
|
55
|
-
send_gifs: rights?.canSendAnimations
|
|
56
|
-
send_games: rights?.canSendGames
|
|
57
|
-
send_inline: rights?.canSendInlineBotResults
|
|
58
|
-
embed_links: rights?.canAddWebPagePreviews
|
|
59
|
-
change_info: rights?.canChangeInfo
|
|
60
|
-
invite_users: rights?.canInviteUsers
|
|
61
|
-
pin_messages: rights?.canPinMessages
|
|
62
|
-
manage_topics: rights?.canManageTopics
|
|
46
|
+
send_messages: rights?.canSendMessages === false || undefined,
|
|
47
|
+
send_audios: rights?.canSendAudio === false || undefined,
|
|
48
|
+
send_docs: rights?.canSendDocuments === false || undefined,
|
|
49
|
+
send_photos: rights?.canSendPhotos === false || undefined,
|
|
50
|
+
send_videos: rights?.canSendVideos === false || undefined,
|
|
51
|
+
send_roundvideos: rights?.canSendVideoNotes === false || undefined,
|
|
52
|
+
send_voices: rights?.canSendVoice === false || undefined,
|
|
53
|
+
send_polls: rights?.canSendPolls === false || undefined,
|
|
54
|
+
send_stickers: rights?.canSendStickers === false || undefined,
|
|
55
|
+
send_gifs: rights?.canSendAnimations === false || undefined,
|
|
56
|
+
send_games: rights?.canSendGames === false || undefined,
|
|
57
|
+
send_inline: rights?.canSendInlineBotResults === false || undefined,
|
|
58
|
+
embed_links: rights?.canAddWebPagePreviews === false || undefined,
|
|
59
|
+
change_info: rights?.canChangeInfo === false || undefined,
|
|
60
|
+
invite_users: rights?.canInviteUsers === false || undefined,
|
|
61
|
+
pin_messages: rights?.canPinMessages === false || undefined,
|
|
62
|
+
manage_topics: rights?.canManageTopics === false || undefined,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -51,8 +51,8 @@ export function constructChatPhoto(photo, chatId, chatAccessHash) {
|
|
|
51
51
|
smallFileUniqueId,
|
|
52
52
|
bigFileId,
|
|
53
53
|
bigFileUniqueId,
|
|
54
|
-
hasVideo: photo.has_video
|
|
55
|
-
isPersonal: photo.personal
|
|
54
|
+
hasVideo: !!photo.has_video,
|
|
55
|
+
isPersonal: !!photo.personal,
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
package/esm/types/0_dice.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import type { Api } from "../2_tl.js";
|
|
21
21
|
/** A rolled dice. */
|
|
22
22
|
export interface Dice {
|
|
23
|
-
/** The emoji on which the dice is based
|
|
23
|
+
/** The emoji on which the dice is based. */
|
|
24
24
|
emoji: string;
|
|
25
25
|
/** The result of the roll, which is in the range of 1-6 for the emojis "🎲", "🎯" and "🎳", 1-5 for the emojis "🏀" and "⚽", and 1-64 for the emoji "🎰". */
|
|
26
26
|
value: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_dice.d.ts","sourceRoot":"","sources":["../../src/types/0_dice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAqB;AACrB,MAAM,WAAW,IAAI;IACnB
|
|
1
|
+
{"version":3,"file":"0_dice.d.ts","sourceRoot":"","sources":["../../src/types/0_dice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAqB;AACrB,MAAM,WAAW,IAAI;IACnB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6JAA6J;IAC7J,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAE/D"}
|
|
@@ -22,7 +22,7 @@ export function constructGiveawayParameters(g) {
|
|
|
22
22
|
const countries = g.countries_iso2 ?? [];
|
|
23
23
|
const boostedChatId = Api.peerToChatId({ _: "peerChannel", channel_id: g.channels[0] });
|
|
24
24
|
const additionalChatIds = g.channels.slice(1).map((v) => Api.peerToChatId({ _: "peerChannel", channel_id: v }));
|
|
25
|
-
const onlyNewMembers = g.only_new_subscribers
|
|
25
|
+
const onlyNewMembers = !!g.only_new_subscribers;
|
|
26
26
|
const winnerSelectionDate = g.until_date;
|
|
27
27
|
return { boostedChatId, additionalChatIds, winnerSelectionDate, onlyNewMembers, countries };
|
|
28
28
|
}
|
|
@@ -22,7 +22,7 @@ import type { Api } from "../2_tl.js";
|
|
|
22
22
|
export interface LiveStreamChannel {
|
|
23
23
|
/** The live stream channel's unique identifier. */
|
|
24
24
|
id: number;
|
|
25
|
-
/** The scale of the live stream channel's chunks. Duration of each chunk is equal to 1000 / 2 ^ scale.
|
|
25
|
+
/** The scale of the live stream channel's chunks. Duration of each chunk is equal to 1000 / 2 ^ scale. */
|
|
26
26
|
scale: number;
|
|
27
27
|
/** The live stream channel's last timestamp. */
|
|
28
28
|
timestamp: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_live_stream_channel.d.ts","sourceRoot":"","sources":["../../src/types/0_live_stream_channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,6BAA6B;AAC7B,MAAM,WAAW,iBAAiB;IAChC,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,
|
|
1
|
+
{"version":3,"file":"0_live_stream_channel.d.ts","sourceRoot":"","sources":["../../src/types/0_live_stream_channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,6BAA6B;AAC7B,MAAM,WAAW,iBAAiB;IAChC,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,0GAA0G;IAC1G,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,GAAG,CAAC,sBAAsB,GAAG,iBAAiB,CAMjG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import type { Api } from "../2_tl.js";
|
|
21
|
+
/** @unlisted */
|
|
22
|
+
export interface ReportReasonSpam {
|
|
23
|
+
type: "spam";
|
|
24
|
+
}
|
|
25
|
+
/** @unlisted */
|
|
26
|
+
export interface ReportReasonViolence {
|
|
27
|
+
type: "violence";
|
|
28
|
+
}
|
|
29
|
+
/** @unlisted */
|
|
30
|
+
export interface ReportReasonPornography {
|
|
31
|
+
type: "pornography";
|
|
32
|
+
}
|
|
33
|
+
/** @unlisted */
|
|
34
|
+
export interface ReportReasonChildAbuse {
|
|
35
|
+
type: "childAbuse";
|
|
36
|
+
}
|
|
37
|
+
/** @unlisted */
|
|
38
|
+
export interface ReportReasonOther {
|
|
39
|
+
type: "other";
|
|
40
|
+
}
|
|
41
|
+
/** @unlisted */
|
|
42
|
+
export interface ReportReasonCopyright {
|
|
43
|
+
type: "copyright";
|
|
44
|
+
}
|
|
45
|
+
/** @unlisted */
|
|
46
|
+
export interface ReportReasonLocationIrrelevant {
|
|
47
|
+
type: "locationIrrelevant";
|
|
48
|
+
}
|
|
49
|
+
/** @unlisted */
|
|
50
|
+
export interface ReportReasonFake {
|
|
51
|
+
type: "fake";
|
|
52
|
+
}
|
|
53
|
+
/** @unlisted */
|
|
54
|
+
export interface ReportReasonIllegalDrugs {
|
|
55
|
+
type: "illegalDrugs";
|
|
56
|
+
}
|
|
57
|
+
/** @unlisted */
|
|
58
|
+
export interface ReportReasonPersonalDetails {
|
|
59
|
+
type: "personalDetails";
|
|
60
|
+
}
|
|
61
|
+
export type ReportReason = ReportReasonSpam | ReportReasonViolence | ReportReasonPornography | ReportReasonChildAbuse | ReportReasonOther | ReportReasonCopyright | ReportReasonLocationIrrelevant | ReportReasonFake | ReportReasonIllegalDrugs | ReportReasonPersonalDetails;
|
|
62
|
+
export declare function reportReasonToTlObject(reportReason: ReportReason): Api.ReportReason;
|
|
63
|
+
//# sourceMappingURL=0_report_reason.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_report_reason.d.ts","sourceRoot":"","sources":["../../src/types/0_report_reason.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,gBAAgB;AAChB,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;CACf;AAED,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,gBAAgB;AAChB,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,oBAAoB,CAAC;CAC5B;AAED,gBAAgB;AAChB,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,gBAAgB;AAChB,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,oBAAoB,GAAG,uBAAuB,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,8BAA8B,GAAG,gBAAgB,GAAG,wBAAwB,GAAG,2BAA2B,CAAC;AAE/Q,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,GAAG,CAAC,YAAY,CAyBnF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { unreachable } from "../0_deps.js";
|
|
21
|
+
export function reportReasonToTlObject(reportReason) {
|
|
22
|
+
switch (reportReason.type) {
|
|
23
|
+
case "spam":
|
|
24
|
+
return { _: "inputReportReasonSpam" };
|
|
25
|
+
case "violence":
|
|
26
|
+
return { _: "inputReportReasonViolence" };
|
|
27
|
+
case "pornography":
|
|
28
|
+
return { _: "inputReportReasonPornography" };
|
|
29
|
+
case "childAbuse":
|
|
30
|
+
return { _: "inputReportReasonChildAbuse" };
|
|
31
|
+
case "other":
|
|
32
|
+
return { _: "inputReportReasonOther" };
|
|
33
|
+
case "copyright":
|
|
34
|
+
return { _: "inputReportReasonCopyright" };
|
|
35
|
+
case "locationIrrelevant":
|
|
36
|
+
return { _: "inputReportReasonGeoIrrelevant" };
|
|
37
|
+
case "fake":
|
|
38
|
+
return { _: "inputReportReasonFake" };
|
|
39
|
+
case "illegalDrugs":
|
|
40
|
+
return { _: "inputReportReasonIllegalDrugs" };
|
|
41
|
+
case "personalDetails":
|
|
42
|
+
return { _: "inputReportReasonPersonalDetails" };
|
|
43
|
+
}
|
|
44
|
+
unreachable();
|
|
45
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import type { Api } from "../2_tl.js";
|
|
21
|
+
export interface StoryReportOption {
|
|
22
|
+
text: string;
|
|
23
|
+
option: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function constructStoryReportOption(rr: Api.messageReportOption): StoryReportOption;
|
|
26
|
+
//# sourceMappingURL=0_story_report_option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_story_report_option.d.ts","sourceRoot":"","sources":["../../src/types/0_story_report_option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,GAAG,CAAC,mBAAmB,GAAG,iBAAiB,CAIzF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { base64EncodeUrlSafe } from "../1_utilities.js";
|
|
21
|
+
export function constructStoryReportOption(rr) {
|
|
22
|
+
const text = rr.text;
|
|
23
|
+
const option = base64EncodeUrlSafe(rr.option);
|
|
24
|
+
return { text, option };
|
|
25
|
+
}
|
|
@@ -29,7 +29,7 @@ export function constructVideoChat(call) {
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
const title = call.title ?? "";
|
|
32
|
-
const liveStream = call.rtmp_stream
|
|
32
|
+
const liveStream = !!call.rtmp_stream;
|
|
33
33
|
const participantCount = call.participants_count;
|
|
34
34
|
if (call.schedule_date) {
|
|
35
35
|
return {
|
|
@@ -47,7 +47,7 @@ export function constructVideoChat(call) {
|
|
|
47
47
|
id,
|
|
48
48
|
title,
|
|
49
49
|
isLiveStream: liveStream,
|
|
50
|
-
isRecording: call.record_video_active
|
|
50
|
+
isRecording: !!call.record_video_active,
|
|
51
51
|
participantCount,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
@@ -102,14 +102,14 @@ export interface InlineKeyboardButtonGame extends _InlineKeyboardButtonBase {
|
|
|
102
102
|
type: "callbackGame";
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* An inline keyboard that, when pressed, initiates a payment.
|
|
105
|
+
* An inline keyboard button that, when pressed, initiates a payment.
|
|
106
106
|
* @unlisted
|
|
107
107
|
*/
|
|
108
108
|
export interface InlineKeyboardButtonPay extends _InlineKeyboardButtonBase {
|
|
109
109
|
type: "pay";
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
* An inline keyboard that, when pressed, copies the text inside its `copy` field.
|
|
112
|
+
* An inline keyboard button that, when pressed, copies the text inside its `copy` field.
|
|
113
113
|
* @unlisted
|
|
114
114
|
*/
|
|
115
115
|
export interface InlineKeyboardButtonCopy extends _InlineKeyboardButtonBase {
|
|
@@ -36,6 +36,6 @@ export function constructMessageReaction(reaction_, recentReactions) {
|
|
|
36
36
|
.map((v) => Api.peerToChatId(v.peer_id));
|
|
37
37
|
const reaction = constructReaction(reaction_.reaction);
|
|
38
38
|
const count = reaction_.count;
|
|
39
|
-
const chosen = reaction_.chosen_order !== undefined
|
|
39
|
+
const chosen = reaction_.chosen_order !== undefined;
|
|
40
40
|
return { reaction, count, choosers, isChosen: chosen };
|
|
41
41
|
}
|
package/esm/types/1_sticker.js
CHANGED
|
@@ -45,7 +45,7 @@ export function constructSticker2(document, fileId, fileUniqueId, setName, custo
|
|
|
45
45
|
premiumAnimation: undefined, // TODO
|
|
46
46
|
maskPosition: stickerAttribute ? stickerAttribute.mask_coords ? constructMaskPosition(stickerAttribute.mask_coords) : undefined : undefined,
|
|
47
47
|
customEmojiId: customEmojiAttribute ? customEmojiId : undefined,
|
|
48
|
-
needsRepainting: customEmojiAttribute ?
|
|
48
|
+
needsRepainting: customEmojiAttribute ? !!customEmojiAttribute.text_color : undefined,
|
|
49
49
|
fileSize: Number(document.size),
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -21,6 +21,6 @@ import { constructReaction } from "./0_reaction.js";
|
|
|
21
21
|
export function constructStoryReaction(reaction_) {
|
|
22
22
|
const reaction = constructReaction(reaction_.reaction);
|
|
23
23
|
const count = reaction_.count;
|
|
24
|
-
const chosen = reaction_.chosen_order !== undefined
|
|
24
|
+
const chosen = reaction_.chosen_order !== undefined;
|
|
25
25
|
return { reaction, count, isChosen: chosen };
|
|
26
26
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import type { Api } from "../2_tl.js";
|
|
21
|
+
import { type StoryReportOption } from "./0_story_report_option.js";
|
|
22
|
+
/** @unlisted */
|
|
23
|
+
export interface StoryReportResultOptionRequired {
|
|
24
|
+
type: "optionRequired";
|
|
25
|
+
title: string;
|
|
26
|
+
options: StoryReportOption[];
|
|
27
|
+
}
|
|
28
|
+
/** @unlisted */
|
|
29
|
+
export interface StoryReportResultTextRequired {
|
|
30
|
+
type: "textRequired";
|
|
31
|
+
option: string;
|
|
32
|
+
isOptional: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** @unlisted */
|
|
35
|
+
export interface StoryReportResultReported {
|
|
36
|
+
type: "reported";
|
|
37
|
+
}
|
|
38
|
+
export type StoryReportResult = StoryReportResultOptionRequired | StoryReportResultTextRequired | StoryReportResultReported;
|
|
39
|
+
export declare function constructStoryReportResult(rr: Api.ReportResult): StoryReportResult;
|
|
40
|
+
//# sourceMappingURL=1_story_report_result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_story_report_result.d.ts","sourceRoot":"","sources":["../../src/types/1_story_report_result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEhG,gBAAgB;AAChB,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,gBAAgB;AAChB,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG,+BAA+B,GAAG,6BAA6B,GAAG,yBAAyB,CAAC;AAE5H,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,GAAG,CAAC,YAAY,GAAG,iBAAiB,CAclF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { unreachable } from "../0_deps.js";
|
|
21
|
+
import { base64EncodeUrlSafe } from "../1_utilities.js";
|
|
22
|
+
import { constructStoryReportOption } from "./0_story_report_option.js";
|
|
23
|
+
export function constructStoryReportResult(rr) {
|
|
24
|
+
switch (rr._) {
|
|
25
|
+
case "reportResultChooseOption": {
|
|
26
|
+
const title = rr.title;
|
|
27
|
+
const options = rr.options.map(constructStoryReportOption);
|
|
28
|
+
return { type: "optionRequired", title, options };
|
|
29
|
+
}
|
|
30
|
+
case "reportResultAddComment":
|
|
31
|
+
return { type: "textRequired", option: base64EncodeUrlSafe(rr.option), isOptional: !!rr.optional };
|
|
32
|
+
case "reportResultReported":
|
|
33
|
+
return { type: "reported" };
|
|
34
|
+
}
|
|
35
|
+
unreachable();
|
|
36
|
+
}
|
package/esm/types/2_chat.js
CHANGED
|
@@ -40,7 +40,7 @@ export function constructChat(fullChat, getPeer) {
|
|
|
40
40
|
}
|
|
41
41
|
else if (Api.is("chatFull", fullChat)) {
|
|
42
42
|
const peer = getPeer({ _: "peerChat", chat_id: fullChat.id });
|
|
43
|
-
if (peer
|
|
43
|
+
if (!peer)
|
|
44
44
|
unreachable();
|
|
45
45
|
return cleanObject({
|
|
46
46
|
...peer[0],
|
|
@@ -50,7 +50,7 @@ export function constructChat(fullChat, getPeer) {
|
|
|
50
50
|
}
|
|
51
51
|
else if (Api.is("channelFull", fullChat)) {
|
|
52
52
|
const peer = getPeer({ _: "peerChannel", channel_id: fullChat.id });
|
|
53
|
-
if (peer
|
|
53
|
+
if (!peer)
|
|
54
54
|
unreachable();
|
|
55
55
|
return cleanObject({
|
|
56
56
|
...peer[0],
|
|
@@ -24,7 +24,7 @@ import { constructChatAdministratorRights } from "./0_chat_administrator_rights.
|
|
|
24
24
|
import { constructChatMemberRights } from "./0_chat_member_rights.js";
|
|
25
25
|
export function constructChatMember(member, participant, getPeer) {
|
|
26
26
|
const peer = "user_id" in participant ? getPeer({ ...participant, _: "peerUser" }) : "peer" in participant ? Array.isArray(participant.peer) ? participant.peer : Api.is("peerUser", participant.peer) ? getPeer(participant.peer) : unreachable() : unreachable(); // TODO: support other peer types
|
|
27
|
-
if (peer
|
|
27
|
+
if (!peer || peer[0].type !== "private")
|
|
28
28
|
unreachable();
|
|
29
29
|
if (Api.is("channelParticipant", participant) || Api.is("chatParticipant", participant)) {
|
|
30
30
|
return {
|
|
@@ -36,7 +36,7 @@ export function constructChatMember(member, participant, getPeer) {
|
|
|
36
36
|
return cleanObject({
|
|
37
37
|
status: "creator",
|
|
38
38
|
member,
|
|
39
|
-
isAnonymous: participant.admin_rights.anonymous
|
|
39
|
+
isAnonymous: !!participant.admin_rights.anonymous,
|
|
40
40
|
title: participant.rank,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -58,7 +58,7 @@ export function constructChatMember(member, participant, getPeer) {
|
|
|
58
58
|
until,
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
const isMember = participant.left
|
|
61
|
+
const isMember = !!participant.left;
|
|
62
62
|
const rights = constructChatMemberRights(participant.banned_rights);
|
|
63
63
|
const tag = participant.rank;
|
|
64
64
|
return cleanObject({
|
|
@@ -116,7 +116,7 @@ export function constructMessageEntity(obj) {
|
|
|
116
116
|
return { type: "strikethrough", offset: obj.offset, length: obj.length };
|
|
117
117
|
}
|
|
118
118
|
else if (Api.is("messageEntityBlockquote", obj)) {
|
|
119
|
-
return cleanObject({ type: "blockquote", offset: obj.offset, length: obj.length, collapsible: obj.collapsed
|
|
119
|
+
return cleanObject({ type: "blockquote", offset: obj.offset, length: obj.length, collapsible: obj.collapsed || undefined });
|
|
120
120
|
}
|
|
121
121
|
else if (Api.is("messageEntityBankCard", obj)) {
|
|
122
122
|
return { type: "bankCard", offset: obj.offset, length: obj.length };
|
|
@@ -51,8 +51,8 @@ export function constructStoryInteractiveArea(area) {
|
|
|
51
51
|
position,
|
|
52
52
|
reaction,
|
|
53
53
|
count: 0, // TODO: count
|
|
54
|
-
isFlipped: area.flipped
|
|
55
|
-
isDark: area.dark
|
|
54
|
+
isFlipped: !!area.flipped,
|
|
55
|
+
isDark: !!area.dark,
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
else if (Api.is("mediaAreaChannelPost", area)) {
|
|
@@ -117,7 +117,7 @@ export function storyInteractiveAreaToTlObject(area, getPeer) {
|
|
|
117
117
|
}
|
|
118
118
|
case "reaction": {
|
|
119
119
|
const reaction = reactionToTlObject(area.reaction);
|
|
120
|
-
return { _: "mediaAreaSuggestedReaction", coordinates, reaction, dark: area.isDark
|
|
120
|
+
return { _: "mediaAreaSuggestedReaction", coordinates, reaction, dark: area.isDark || undefined, flipped: area.isFlipped || undefined };
|
|
121
121
|
}
|
|
122
122
|
case "messageReference": {
|
|
123
123
|
const peer = getPeer(Api.chatIdToPeer(area.messageReference.chatId));
|
|
@@ -35,7 +35,7 @@ export function constructChatSettings(settings_) {
|
|
|
35
35
|
businessBotCanReply: settings_.settings.business_bot_can_reply || false,
|
|
36
36
|
distance: settings_.settings.geo_distance,
|
|
37
37
|
joinRequestChatTitle: settings_.settings.request_chat_title,
|
|
38
|
-
joinRequestDate: settings_.settings.request_chat_date
|
|
38
|
+
joinRequestDate: settings_.settings.request_chat_date || undefined,
|
|
39
39
|
businessBotUrl: settings_.settings.business_bot_manage_url,
|
|
40
40
|
messagePrice: settings_.settings.charge_paid_message_stars ? Number(settings_.settings.charge_paid_message_stars) : undefined,
|
|
41
41
|
registrationMonth: settings_.settings.registration_month,
|