@mtkruto/node 0.2.11 → 0.2.21
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 +5 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +5 -0
- package/esm/client/0_filters.d.ts +1 -1
- package/esm/client/0_filters.d.ts.map +1 -1
- package/esm/client/0_html.js +1 -1
- package/esm/client/0_message.d.ts +1 -1
- package/esm/client/0_message.d.ts.map +1 -1
- package/esm/client/0_message.js +2 -2
- package/esm/client/0_params.d.ts +17 -6
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_storage_operations.d.ts +1 -1
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +1 -1
- package/esm/client/1_client_encrypted.d.ts.map +1 -1
- package/esm/client/1_client_encrypted.js +51 -6
- package/esm/client/1_client_plain.js +1 -1
- package/esm/client/1_types.d.ts +1 -1
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.d.ts +3 -1
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +5 -3
- package/esm/client/2_payment_manager.d.ts +35 -0
- package/esm/client/2_payment_manager.d.ts.map +1 -0
- package/esm/client/2_payment_manager.js +68 -0
- package/esm/client/2_reaction_manager.d.ts +2 -1
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +8 -7
- package/esm/client/3_message_manager.d.ts +7 -2
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +53 -13
- package/esm/client/3_video_chat_manager.d.ts +2 -1
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +5 -2
- package/esm/client/4_callback_query_manager.d.ts +2 -1
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +6 -2
- package/esm/client/4_chat_list_manager.d.ts +2 -1
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +12 -2
- package/esm/client/4_inline_query_manager.d.ts +2 -1
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +6 -2
- package/esm/client/4_story_manager.d.ts +2 -1
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +5 -2
- package/esm/client/5_client.d.ts +51 -3
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +87 -12
- package/esm/connection/1_connection_tcp.node.d.ts +19 -0
- package/esm/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/esm/connection/1_connection_tcp.node.js +22 -1
- package/esm/connection/1_connection_web_socket.d.ts.map +1 -1
- package/esm/connection/1_connection_web_socket.js +1 -0
- package/esm/tl/1_utilities.d.ts +1 -1
- package/esm/tl/1_utilities.d.ts.map +1 -1
- package/esm/tl/5_message.d.ts +1 -1
- package/esm/tl/5_message.d.ts.map +1 -1
- package/esm/tl/5_message.js +2 -2
- package/esm/types/0_invoice.d.ts +19 -0
- package/esm/types/0_invoice.d.ts.map +1 -1
- package/esm/types/0_invoice.js +19 -0
- package/esm/types/0_shipping_address.d.ts +31 -0
- package/esm/types/0_shipping_address.d.ts.map +1 -0
- package/esm/types/0_shipping_address.js +29 -0
- package/esm/types/1_keyboard_button.d.ts +7 -0
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_order_info.d.ts +29 -0
- package/esm/types/1_order_info.d.ts.map +1 -0
- package/esm/types/1_order_info.js +29 -0
- package/esm/types/2_chat.d.ts +2 -2
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +3 -3
- package/esm/types/2_pre_checkout_query.d.ts +34 -0
- package/esm/types/2_pre_checkout_query.d.ts.map +1 -0
- package/esm/types/2_pre_checkout_query.js +39 -0
- package/esm/types/2_successful_payment.d.ts +32 -0
- package/esm/types/2_successful_payment.d.ts.map +1 -0
- package/esm/types/2_successful_payment.js +32 -0
- package/esm/types/3_join_request.d.ts +20 -0
- package/esm/types/3_join_request.d.ts.map +1 -0
- package/esm/types/3_join_request.js +26 -0
- package/esm/types/4_inline_query_result.d.ts +1 -1
- package/esm/types/4_inline_query_result.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.js +2 -2
- package/esm/types/4_message.d.ts +11 -1
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +9 -0
- package/esm/types/6_update.d.ts +20 -3
- package/esm/types/6_update.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/3_types.d.ts +5 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +5 -0
- package/script/client/0_filters.d.ts +1 -1
- package/script/client/0_filters.d.ts.map +1 -1
- package/script/client/0_html.js +1 -1
- package/script/client/0_message.d.ts +1 -1
- package/script/client/0_message.d.ts.map +1 -1
- package/script/client/0_message.js +2 -2
- package/script/client/0_params.d.ts +17 -6
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_storage_operations.d.ts +1 -1
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +1 -1
- package/script/client/1_client_encrypted.d.ts.map +1 -1
- package/script/client/1_client_encrypted.js +50 -5
- package/script/client/1_client_plain.js +1 -1
- package/script/client/1_types.d.ts +1 -1
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.d.ts +3 -1
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +6 -4
- package/script/client/2_payment_manager.d.ts +35 -0
- package/script/client/2_payment_manager.d.ts.map +1 -0
- package/script/client/2_payment_manager.js +72 -0
- package/script/client/2_reaction_manager.d.ts +2 -1
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +8 -7
- package/script/client/3_message_manager.d.ts +7 -2
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +51 -11
- package/script/client/3_video_chat_manager.d.ts +2 -1
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +4 -1
- package/script/client/4_callback_query_manager.d.ts +2 -1
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +6 -2
- package/script/client/4_chat_list_manager.d.ts +2 -1
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +11 -1
- package/script/client/4_inline_query_manager.d.ts +2 -1
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +5 -1
- package/script/client/4_story_manager.d.ts +2 -1
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +4 -1
- package/script/client/5_client.d.ts +51 -3
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +87 -12
- package/script/connection/1_connection_tcp.node.d.ts +19 -0
- package/script/connection/1_connection_tcp.node.d.ts.map +1 -1
- package/script/connection/1_connection_tcp.node.js +22 -1
- package/script/connection/1_connection_web_socket.d.ts.map +1 -1
- package/script/connection/1_connection_web_socket.js +1 -0
- package/script/tl/1_utilities.d.ts +1 -1
- package/script/tl/1_utilities.d.ts.map +1 -1
- package/script/tl/5_message.d.ts +1 -1
- package/script/tl/5_message.d.ts.map +1 -1
- package/script/tl/5_message.js +2 -2
- package/script/types/0_invoice.d.ts +19 -0
- package/script/types/0_invoice.d.ts.map +1 -1
- package/script/types/0_invoice.js +19 -0
- package/script/types/0_shipping_address.d.ts +31 -0
- package/script/types/0_shipping_address.d.ts.map +1 -0
- package/script/types/0_shipping_address.js +33 -0
- package/script/types/1_keyboard_button.d.ts +7 -0
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_order_info.d.ts +29 -0
- package/script/types/1_order_info.d.ts.map +1 -0
- package/script/types/1_order_info.js +33 -0
- package/script/types/2_chat.d.ts +2 -2
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +3 -3
- package/script/types/2_pre_checkout_query.d.ts +34 -0
- package/script/types/2_pre_checkout_query.d.ts.map +1 -0
- package/script/types/2_pre_checkout_query.js +43 -0
- package/script/types/2_successful_payment.d.ts +32 -0
- package/script/types/2_successful_payment.d.ts.map +1 -0
- package/script/types/2_successful_payment.js +36 -0
- package/script/types/3_join_request.d.ts +20 -0
- package/script/types/3_join_request.d.ts.map +1 -0
- package/script/types/3_join_request.js +30 -0
- package/script/types/4_inline_query_result.d.ts +1 -1
- package/script/types/4_inline_query_result.d.ts.map +1 -1
- package/script/types/4_inline_query_result.js +2 -2
- package/script/types/4_message.d.ts +11 -1
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +9 -0
- package/script/types/6_update.d.ts +20 -3
- package/script/types/6_update.d.ts.map +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2024 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
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
21
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
22
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
23
|
+
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");
|
|
24
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
25
|
+
};
|
|
26
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
27
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
28
|
+
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");
|
|
29
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
+
};
|
|
31
|
+
var _PaymentManager_c;
|
|
32
|
+
import { InputError } from "../0_errors.js";
|
|
33
|
+
import { is, isOneOf } from "../2_tl.js";
|
|
34
|
+
import { constructPreCheckoutQuery } from "../3_types.js";
|
|
35
|
+
const paymentManagerUpdates = [
|
|
36
|
+
"updateBotPrecheckoutQuery",
|
|
37
|
+
];
|
|
38
|
+
export class PaymentManager {
|
|
39
|
+
constructor(c) {
|
|
40
|
+
_PaymentManager_c.set(this, void 0);
|
|
41
|
+
__classPrivateFieldSet(this, _PaymentManager_c, c, "f");
|
|
42
|
+
}
|
|
43
|
+
static canHandleUpdate(update) {
|
|
44
|
+
return isOneOf(paymentManagerUpdates, update);
|
|
45
|
+
}
|
|
46
|
+
async handleUpdate(update) {
|
|
47
|
+
if (is("updateBotPrecheckoutQuery", update)) {
|
|
48
|
+
const preCheckoutQuery = await constructPreCheckoutQuery(update, __classPrivateFieldGet(this, _PaymentManager_c, "f").getEntity);
|
|
49
|
+
return { preCheckoutQuery };
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
async answerPreCheckoutQuery(preCheckoutQueryId, ok, params) {
|
|
54
|
+
await __classPrivateFieldGet(this, _PaymentManager_c, "f").storage.assertBot("answerPreCheckoutQuery");
|
|
55
|
+
if (!ok && !params?.error) {
|
|
56
|
+
throw new InputError("error is required when ok is false");
|
|
57
|
+
}
|
|
58
|
+
const queryId = BigInt(preCheckoutQueryId);
|
|
59
|
+
if (!queryId) {
|
|
60
|
+
throw new InputError("Invalid pre-checkout query ID");
|
|
61
|
+
}
|
|
62
|
+
await __classPrivateFieldGet(this, _PaymentManager_c, "f").invoke({ _: "messages.setBotPrecheckoutResults", query_id: queryId, error: params?.error, success: ok ? true : undefined });
|
|
63
|
+
}
|
|
64
|
+
async refundStarPayment(userId, telegramPaymentChargeId) {
|
|
65
|
+
await __classPrivateFieldGet(this, _PaymentManager_c, "f").invoke({ _: "payments.refundStarsCharge", user_id: await __classPrivateFieldGet(this, _PaymentManager_c, "f").getInputUser(userId), charge_id: telegramPaymentChargeId });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
_PaymentManager_c = new WeakMap();
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { Update } from "../3_types.js";
|
|
22
22
|
import { C } from "./1_types.js";
|
|
23
|
-
|
|
23
|
+
declare const reactionManagerUpdates: readonly ["updateBotMessageReactions", "updateBotMessageReaction", "updateMessageReactions", "updateChannelMessageViews", "updateChannelMessageForwards"];
|
|
24
|
+
type ReactionManagerUpdate = Api.Types[(typeof reactionManagerUpdates)[number]];
|
|
24
25
|
export declare class ReactionManager {
|
|
25
26
|
#private;
|
|
26
27
|
constructor(c: C);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_reaction_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_reaction_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAA6B,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAsF,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3H,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,
|
|
1
|
+
{"version":3,"file":"2_reaction_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_reaction_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAA6B,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAsF,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3H,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,QAAA,MAAM,sBAAsB,2JAMlB,CAAC;AAEX,KAAK,qBAAqB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhF,qBAAa,eAAe;;gBAGd,CAAC,EAAE,CAAC;IAIhB,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,qBAAqB;IAIrE,YAAY,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAmD1E"}
|
|
@@ -32,19 +32,20 @@ var _ReactionManager_c;
|
|
|
32
32
|
import { unreachable } from "../0_deps.js";
|
|
33
33
|
import { is, isOneOf, peerToChatId } from "../2_tl.js";
|
|
34
34
|
import { constructMessageReaction, constructMessageReactionCount, constructMessageReactions } from "../3_types.js";
|
|
35
|
+
const reactionManagerUpdates = [
|
|
36
|
+
"updateBotMessageReactions",
|
|
37
|
+
"updateBotMessageReaction",
|
|
38
|
+
"updateMessageReactions",
|
|
39
|
+
"updateChannelMessageViews",
|
|
40
|
+
"updateChannelMessageForwards",
|
|
41
|
+
];
|
|
35
42
|
export class ReactionManager {
|
|
36
43
|
constructor(c) {
|
|
37
44
|
_ReactionManager_c.set(this, void 0);
|
|
38
45
|
__classPrivateFieldSet(this, _ReactionManager_c, c, "f");
|
|
39
46
|
}
|
|
40
47
|
static canHandleUpdate(update) {
|
|
41
|
-
return isOneOf(
|
|
42
|
-
"updateBotMessageReactions",
|
|
43
|
-
"updateBotMessageReaction",
|
|
44
|
-
"updateMessageReactions",
|
|
45
|
-
"updateChannelMessageViews",
|
|
46
|
-
"updateChannelMessageForwards",
|
|
47
|
-
], update);
|
|
48
|
+
return isOneOf(reactionManagerUpdates, update);
|
|
48
49
|
}
|
|
49
50
|
async handleUpdate(update) {
|
|
50
51
|
if (is("updateBotMessageReactions", update)) {
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { InputMedia, PollOption, PriceTag } from "../3_types.js";
|
|
22
22
|
import { ChatAction, FileSource, FileType, ID, Message, MessageEntity, ParseMode, Reaction, Update, UsernameResolver } from "../3_types.js";
|
|
23
|
-
import { AddReactionParams, BanChatMemberParams, CreateInviteLinkParams, DeleteMessagesParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetCreatedInviteLinksParams, GetHistoryParams, PinMessageParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChatActionParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInvoiceParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetReactionsParams, StopPollParams } from "./0_params.js";
|
|
23
|
+
import { AddReactionParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, DeleteMessagesParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetCreatedInviteLinksParams, GetHistoryParams, PinMessageParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendChatActionParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInvoiceParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetReactionsParams, StopPollParams } from "./0_params.js";
|
|
24
24
|
import { C as C_ } from "./1_types.js";
|
|
25
25
|
import { FileManager } from "./2_file_manager.js";
|
|
26
26
|
interface C extends C_ {
|
|
27
27
|
fileManager: FileManager;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
declare const messageManagerUpdates: readonly ["updateNewMessage", "updateNewChannelMessage", "updateEditMessage", "updateEditChannelMessage", "updateBotNewBusinessMessage", "updateBotEditBusinessMessage", "updateBotDeleteBusinessMessage", "updateDeleteMessages", "updateDeleteChannelMessages", "updateChannelParticipant", "updateChatParticipant", "updateBotChatInviteRequester"];
|
|
30
|
+
type MessageManagerUpdate = Api.Types[(typeof messageManagerUpdates)[number]];
|
|
30
31
|
export declare class MessageManager {
|
|
31
32
|
#private;
|
|
32
33
|
constructor(c: C);
|
|
@@ -89,6 +90,10 @@ export declare class MessageManager {
|
|
|
89
90
|
setChatMemberRights(chatId: ID, memberId: ID, params?: SetChatMemberRightsParams): Promise<void>;
|
|
90
91
|
enableJoinRequests(chatId: ID): Promise<void>;
|
|
91
92
|
disableJoinRequests(chatId: ID): Promise<void>;
|
|
93
|
+
approveJoinRequest(chatId: ID, userId: ID): Promise<void>;
|
|
94
|
+
declineJoinRequest(chatId: ID, userId: ID): Promise<void>;
|
|
95
|
+
approveJoinRequests(chatId: ID, params?: ApproveJoinRequestsParams): Promise<void>;
|
|
96
|
+
declineJoinRequests(chatId: ID, params?: DeclineJoinRequestsParams): Promise<void>;
|
|
92
97
|
searchMessages(chatId: ID, query: string, params?: SearchMessagesParams): Promise<Message[]>;
|
|
93
98
|
setBoostsRequiredToCircumventRestrictions(chatId: ID, boosts: number): Promise<void>;
|
|
94
99
|
createInviteLink(chatId: ID, params?: CreateInviteLinkParams): Promise<import("../3_types.js").InviteLink>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_message_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_message_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"3_message_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_message_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAmD,MAAM,YAAY,CAAC;AAClF,OAAO,EAAoG,UAAU,EAAE,UAAU,EAAE,QAAQ,EAA+C,MAAM,eAAe,CAAC;AAChN,OAAO,EAAqB,UAAU,EAAsH,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,aAAa,EAA2B,SAAS,EAAE,QAAQ,EAA4D,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAItW,OAAO,EAA6B,iBAAiB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIxxB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKlD,UAAU,CAAE,SAAQ,EAAE;IACpB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W,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,EAAE,iBAAiB;CAyDpJ"}
|
|
@@ -32,8 +32,8 @@ var _MessageManager_instances, _MessageManager_c, _MessageManager_LresolveFileId
|
|
|
32
32
|
import { contentType, unreachable } from "../0_deps.js";
|
|
33
33
|
import { InputError } from "../0_errors.js";
|
|
34
34
|
import { getLogger, getRandomId, toUnixTimestamp } from "../1_utilities.js";
|
|
35
|
-
import { as, getChannelChatId, is, peerToChatId } from "../2_tl.js";
|
|
36
|
-
import { constructChatMemberUpdated, constructInviteLink, deserializeFileId, selfDestructOptionToInt } from "../3_types.js";
|
|
35
|
+
import { as, getChannelChatId, is, isOneOf, peerToChatId } from "../2_tl.js";
|
|
36
|
+
import { constructChatMemberUpdated, constructInviteLink, constructJoinRequest, deserializeFileId, selfDestructOptionToInt } from "../3_types.js";
|
|
37
37
|
import { assertMessageType, chatMemberRightsToTlObject, constructChatMember, constructMessage as constructMessage_, deserializeInlineMessageId, FileType, messageEntityToTlObject, reactionEqual, reactionToTlObject, replyMarkupToTlObject } from "../3_types.js";
|
|
38
38
|
import { messageSearchFilterToTlObject } from "../types/0_message_search_filter.js";
|
|
39
39
|
import { parseHtml } from "./0_html.js";
|
|
@@ -43,6 +43,20 @@ import { checkArray } from "./0_utilities.js";
|
|
|
43
43
|
import { isHttpUrl } from "./0_utilities.js";
|
|
44
44
|
const FALLBACK_MIME_TYPE = "application/octet-stream";
|
|
45
45
|
const STICKER_MIME_TYPES = ["image/webp", "video/webm", "application/x-tgsticker"];
|
|
46
|
+
const messageManagerUpdates = [
|
|
47
|
+
"updateNewMessage",
|
|
48
|
+
"updateNewChannelMessage",
|
|
49
|
+
"updateEditMessage",
|
|
50
|
+
"updateEditChannelMessage",
|
|
51
|
+
"updateBotNewBusinessMessage",
|
|
52
|
+
"updateBotEditBusinessMessage",
|
|
53
|
+
"updateBotDeleteBusinessMessage",
|
|
54
|
+
"updateDeleteMessages",
|
|
55
|
+
"updateDeleteChannelMessages",
|
|
56
|
+
"updateChannelParticipant",
|
|
57
|
+
"updateChatParticipant",
|
|
58
|
+
"updateBotChatInviteRequester",
|
|
59
|
+
];
|
|
46
60
|
export class MessageManager {
|
|
47
61
|
constructor(c) {
|
|
48
62
|
_MessageManager_instances.add(this);
|
|
@@ -599,17 +613,7 @@ export class MessageManager {
|
|
|
599
613
|
}
|
|
600
614
|
}
|
|
601
615
|
static canHandleUpdate(update) {
|
|
602
|
-
return
|
|
603
|
-
is("updateNewChannelMessage", update) ||
|
|
604
|
-
is("updateEditMessage", update) ||
|
|
605
|
-
is("updateEditChannelMessage", update) ||
|
|
606
|
-
is("updateBotNewBusinessMessage", update) ||
|
|
607
|
-
is("updateBotEditBusinessMessage", update) ||
|
|
608
|
-
is("updateBotDeleteBusinessMessage", update) ||
|
|
609
|
-
is("updateDeleteMessages", update) ||
|
|
610
|
-
is("updateDeleteChannelMessages", update) ||
|
|
611
|
-
is("updateChannelParticipant", update) ||
|
|
612
|
-
is("updateChatParticipant", update);
|
|
616
|
+
return isOneOf(messageManagerUpdates, update);
|
|
613
617
|
}
|
|
614
618
|
async handleUpdate(update) {
|
|
615
619
|
if (is("updateNewMessage", update) || is("updateNewChannelMessage", update) || is("updateEditMessage", update) || is("updateEditChannelMessage", update)) {
|
|
@@ -680,6 +684,10 @@ export class MessageManager {
|
|
|
680
684
|
return { chatMember };
|
|
681
685
|
}
|
|
682
686
|
}
|
|
687
|
+
if (is("updateBotChatInviteRequester", update)) {
|
|
688
|
+
const joinRequest = await constructJoinRequest(update, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
689
|
+
return { joinRequest };
|
|
690
|
+
}
|
|
683
691
|
return null;
|
|
684
692
|
}
|
|
685
693
|
async sendChatAction(chatId, action, params) {
|
|
@@ -807,6 +815,38 @@ export class MessageManager {
|
|
|
807
815
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("disableJoinRequests");
|
|
808
816
|
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_toggleJoinRequests).call(this, chatId, false);
|
|
809
817
|
}
|
|
818
|
+
async approveJoinRequest(chatId, userId) {
|
|
819
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
820
|
+
_: "messages.hideChatJoinRequest",
|
|
821
|
+
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
822
|
+
user_id: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId),
|
|
823
|
+
approved: true,
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
async declineJoinRequest(chatId, userId) {
|
|
827
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
828
|
+
_: "messages.hideChatJoinRequest",
|
|
829
|
+
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
830
|
+
user_id: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId),
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
async approveJoinRequests(chatId, params) {
|
|
834
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("approveJoinRequests");
|
|
835
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
836
|
+
_: "messages.hideAllChatJoinRequests",
|
|
837
|
+
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
838
|
+
approved: true,
|
|
839
|
+
link: params?.inviteLink,
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
async declineJoinRequests(chatId, params) {
|
|
843
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("declineJoinRequests");
|
|
844
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
845
|
+
_: "messages.hideAllChatJoinRequests",
|
|
846
|
+
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
847
|
+
link: params?.inviteLink,
|
|
848
|
+
});
|
|
849
|
+
}
|
|
810
850
|
async searchMessages(chatId, query, params) {
|
|
811
851
|
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.search", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), q: query, add_offset: 0, filter: messageSearchFilterToTlObject(params?.filter ?? "empty"), hash: 0n, limit: params?.limit ?? 100, max_date: 0, max_id: 0, min_date: 0, min_id: 0, offset_id: params?.after ? params.after : 0, from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined });
|
|
812
852
|
if (!("messages" in result)) {
|
|
@@ -25,7 +25,8 @@ import { FileManager } from "./2_file_manager.js";
|
|
|
25
25
|
interface C extends C_ {
|
|
26
26
|
fileManager: FileManager;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
declare const videoChatManagerUpdates: readonly ["updateGroupCall"];
|
|
29
|
+
type VideoChatManagerUpdate = Api.Types[(typeof videoChatManagerUpdates)[number]];
|
|
29
30
|
export declare class VideoChatManager {
|
|
30
31
|
#private;
|
|
31
32
|
constructor(c: C);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_video_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_video_chat_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"3_video_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/3_video_chat_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAmB,MAAM,YAAY,CAAC;AAClD,OAAO,EAAkD,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,kBA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 var _VideoChatManager_instances, _VideoChatManager_c, _VideoChatManager_createGr
|
|
|
32
32
|
import { unreachable } from "../0_deps.js";
|
|
33
33
|
import { InputError } from "../0_errors.js";
|
|
34
34
|
import { getRandomId, toUnixTimestamp, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
35
|
-
import { as, is } from "../2_tl.js";
|
|
35
|
+
import { as, is, isOneOf } from "../2_tl.js";
|
|
36
36
|
import { constructLiveStreamChannel, constructVideoChat } from "../3_types.js";
|
|
37
|
+
const videoChatManagerUpdates = [
|
|
38
|
+
"updateGroupCall",
|
|
39
|
+
];
|
|
37
40
|
export class VideoChatManager {
|
|
38
41
|
constructor(c) {
|
|
39
42
|
_VideoChatManager_instances.add(this);
|
|
@@ -90,7 +93,7 @@ export class VideoChatManager {
|
|
|
90
93
|
return constructVideoChat(await __classPrivateFieldGet(this, _VideoChatManager_instances, "m", _VideoChatManager_getCall).call(this, id));
|
|
91
94
|
}
|
|
92
95
|
static canHandleUpdate(update) {
|
|
93
|
-
return
|
|
96
|
+
return isOneOf(videoChatManagerUpdates, update);
|
|
94
97
|
}
|
|
95
98
|
async handleUpdate(update) {
|
|
96
99
|
let chatId = Number(-update.chat_id);
|
|
@@ -25,7 +25,8 @@ import { MessageManager } from "./3_message_manager.js";
|
|
|
25
25
|
type C = C_ & {
|
|
26
26
|
messageManager: MessageManager;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
declare const callbackQueryManagerUpdates: readonly ["updateBotCallbackQuery", "updateInlineBotCallbackQuery"];
|
|
29
|
+
type CallbackQueryManagerUpdate = Api.Types[(typeof callbackQueryManagerUpdates)[number]];
|
|
29
30
|
export declare class CallbackQueryManager {
|
|
30
31
|
#private;
|
|
31
32
|
constructor(c: C);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_callback_query_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_callback_query_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;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__classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
31
31
|
var _CallbackQueryManager_instances, _a, _CallbackQueryManager_c, _CallbackQueryManager_enc, _CallbackQueryManager_isExpired, _CallbackQueryManager_getPasswordCheck;
|
|
32
32
|
import { isOneOf, peerToChatId } from "../2_tl.js";
|
|
33
33
|
import { constructCallbackQuery, constructCallbackQueryAnswer, validateCallbackQueryQuestion } from "../3_types.js";
|
|
34
|
-
import { checkCallbackQueryId, checkMessageId } from "./0_utilities.js";
|
|
35
34
|
import { checkPassword } from "./0_password.js";
|
|
35
|
+
import { checkCallbackQueryId, checkMessageId } from "./0_utilities.js";
|
|
36
|
+
const callbackQueryManagerUpdates = [
|
|
37
|
+
"updateBotCallbackQuery",
|
|
38
|
+
"updateInlineBotCallbackQuery",
|
|
39
|
+
];
|
|
36
40
|
export class CallbackQueryManager {
|
|
37
41
|
constructor(c) {
|
|
38
42
|
_CallbackQueryManager_instances.add(this);
|
|
@@ -60,7 +64,7 @@ export class CallbackQueryManager {
|
|
|
60
64
|
return constructCallbackQueryAnswer(answer);
|
|
61
65
|
}
|
|
62
66
|
static canHandleUpdate(update) {
|
|
63
|
-
return isOneOf(
|
|
67
|
+
return isOneOf(callbackQueryManagerUpdates, update);
|
|
64
68
|
}
|
|
65
69
|
async handleUpdate(update) {
|
|
66
70
|
return { callbackQuery: await constructCallbackQuery(update, __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").getEntity, __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").messageManager.getMessageWithReply.bind(__classPrivateFieldGet(this, _CallbackQueryManager_c, "f").messageManager)) };
|
|
@@ -26,7 +26,8 @@ type C = C_ & {
|
|
|
26
26
|
fileManager: FileManager;
|
|
27
27
|
messageManager: MessageManager;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
declare const chatListManagerUpdates: readonly ["updateNewMessage", "updateNewChannelMessage", "updatePinnedDialogs", "updateFolderPeers", "updateChannel", "updateChat", "updateUser", "updateUserName"];
|
|
30
|
+
type ChatListManagerUpdate = Api.Types[(typeof chatListManagerUpdates)[number]];
|
|
30
31
|
export declare class ChatListManager {
|
|
31
32
|
#private;
|
|
32
33
|
constructor(c: C);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_chat_list_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_chat_list_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"4_chat_list_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_chat_list_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAA6B,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAmI,EAAE,EAAE,MAAM,eAAe,CAAC;AAE9L,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,CAAC,GAAG,EAAE,GAAG;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAE3E,QAAA,MAAM,sBAAsB,qKASlB,CAAC;AAEX,KAAK,qBAAqB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhF,qBAAa,eAAe;;gBAKd,CAAC,EAAE,CAAC;IAkBV,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAQ,EAAE,UAAU,UAAO;IAwTtE,QAAQ,CAAC,IAAI,GAAE,UAAU,GAAG,MAAe,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,KAAK,SAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA4B9G,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,qBAAqB;IAIrE,YAAY,CAAC,MAAM,EAAE,qBAAqB;IA0C1C,OAAO,CAAC,MAAM,EAAE,EAAE;IAQlB,qBAAqB,CAAC,MAAM,EAAE,EAAE;CA2BvC"}
|
|
@@ -32,9 +32,19 @@ var _ChatListManager_instances, _ChatListManager_c, _ChatListManager_LgetChats,
|
|
|
32
32
|
import { unreachable } from "../0_deps.js";
|
|
33
33
|
import { InputError } from "../0_errors.js";
|
|
34
34
|
import { getLogger, toUnixTimestamp } from "../1_utilities.js";
|
|
35
|
-
import { is, peerToChatId } from "../2_tl.js";
|
|
35
|
+
import { is, isOneOf, peerToChatId } from "../2_tl.js";
|
|
36
36
|
import { constructChat, constructChatListItem, constructChatListItem3, constructChatListItem4, constructChatMember, getChatListItemOrder } from "../3_types.js";
|
|
37
37
|
import { getChatListId } from "./0_utilities.js";
|
|
38
|
+
const chatListManagerUpdates = [
|
|
39
|
+
"updateNewMessage",
|
|
40
|
+
"updateNewChannelMessage",
|
|
41
|
+
"updatePinnedDialogs",
|
|
42
|
+
"updateFolderPeers",
|
|
43
|
+
"updateChannel",
|
|
44
|
+
"updateChat",
|
|
45
|
+
"updateUser",
|
|
46
|
+
"updateUserName",
|
|
47
|
+
];
|
|
38
48
|
export class ChatListManager {
|
|
39
49
|
constructor(c) {
|
|
40
50
|
_ChatListManager_instances.add(this);
|
|
@@ -141,7 +151,7 @@ export class ChatListManager {
|
|
|
141
151
|
return chats;
|
|
142
152
|
}
|
|
143
153
|
static canHandleUpdate(update) {
|
|
144
|
-
return
|
|
154
|
+
return isOneOf(chatListManagerUpdates, update);
|
|
145
155
|
}
|
|
146
156
|
async handleUpdate(update) {
|
|
147
157
|
if (is("updateNewMessage", update) || is("updateNewChannelMessage", update) || is("updateEditMessage", update) || is("updateEditChannelMessage", update)) {
|
|
@@ -25,7 +25,8 @@ import { MessageManager } from "./3_message_manager.js";
|
|
|
25
25
|
type C = C_ & {
|
|
26
26
|
messageManager: MessageManager;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
declare const inlineQueryManagerUpdates: readonly ["updateBotInlineQuery", "updateBotInlineSend"];
|
|
29
|
+
type InlineQueryManagerUpdate = Api.Types[(typeof inlineQueryManagerUpdates)[number]];
|
|
29
30
|
export declare class InlineQueryManager {
|
|
30
31
|
#private;
|
|
31
32
|
constructor(c: C);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_inline_query_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_inline_query_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"4_inline_query_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_inline_query_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAA6B,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAiF,EAAE,EAAE,iBAAiB,EAA+B,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1K,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,CAAC,GAAG,EAAE,GAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAEjD,QAAA,MAAM,yBAAyB,0DAGrB,CAAC;AAEX,KAAK,wBAAwB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEtF,qBAAa,kBAAkB;;gBAGjB,CAAC,EAAE,CAAC;IAIV,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,CAAC,EAAE,uBAAuB;IAMlG,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,wBAAwB;IAIxE,YAAY,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAU/D,eAAe,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,qBAAqB;CAsB7E"}
|
|
@@ -30,9 +30,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
30
30
|
};
|
|
31
31
|
var _a, _InlineQueryManager_c, _InlineQueryManager_isExpired;
|
|
32
32
|
import { unreachable } from "../0_deps.js";
|
|
33
|
-
import { is, peerToChatId } from "../2_tl.js";
|
|
33
|
+
import { is, isOneOf, peerToChatId } from "../2_tl.js";
|
|
34
34
|
import { constructChosenInlineResult, constructInlineQuery, constructInlineQueryAnswer, inlineQueryResultToTlObject } from "../3_types.js";
|
|
35
35
|
import { checkInlineQueryId } from "./0_utilities.js";
|
|
36
|
+
const inlineQueryManagerUpdates = [
|
|
37
|
+
"updateBotInlineQuery",
|
|
38
|
+
"updateBotInlineSend",
|
|
39
|
+
];
|
|
36
40
|
export class InlineQueryManager {
|
|
37
41
|
constructor(c) {
|
|
38
42
|
_InlineQueryManager_c.set(this, void 0);
|
|
@@ -44,7 +48,7 @@ export class InlineQueryManager {
|
|
|
44
48
|
await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").invoke({ _: "messages.setInlineBotResults", query_id: BigInt(id), results: await Promise.all(results.map((v) => inlineQueryResultToTlObject(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))), cache_time: params?.cacheTime ?? 300, private: params?.isPersonal ? true : undefined, switch_webview: params?.button && params.button.miniApp ? ({ _: "inlineBotWebView", text: params.button.text, url: params.button.miniApp.url }) : undefined, switch_pm: params?.button && params.button.startParameter ? ({ _: "inlineBotSwitchPM", text: params.button.text, start_param: params.button.startParameter }) : undefined, gallery: params?.isGallery ? true : undefined, next_offset: params?.nextOffset });
|
|
45
49
|
}
|
|
46
50
|
static canHandleUpdate(update) {
|
|
47
|
-
return
|
|
51
|
+
return isOneOf(inlineQueryManagerUpdates, update);
|
|
48
52
|
}
|
|
49
53
|
async handleUpdate(update) {
|
|
50
54
|
if (is("updateBotInlineQuery", update)) {
|
|
@@ -28,7 +28,8 @@ type C = C_ & {
|
|
|
28
28
|
fileManager: FileManager;
|
|
29
29
|
messageManager: MessageManager;
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
declare const storyManagerUpdates: readonly ["updateStory"];
|
|
32
|
+
type StoryManagerUpdate = Api.Types[(typeof storyManagerUpdates)[number]];
|
|
32
33
|
export declare class StoryManager {
|
|
33
34
|
#private;
|
|
34
35
|
constructor(c: C);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_story_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_story_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"4_story_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_story_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAkD,MAAM,YAAY,CAAC;AACjF,OAAO,EAA4B,EAAE,EAAE,KAAK,EAA0D,MAAM,EAAE,MAAM,eAAe,CAAC;AACpI,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,CAA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,CAAC;CAYvE"}
|
|
@@ -32,9 +32,12 @@ var _StoryManager_instances, _StoryManager_c, _StoryManager_updatesToStory, _Sto
|
|
|
32
32
|
import { contentType, unreachable } from "../0_deps.js";
|
|
33
33
|
import { InputError } from "../0_errors.js";
|
|
34
34
|
import { getRandomId } from "../1_utilities.js";
|
|
35
|
-
import { as, inputPeerToPeer, is, peerToChatId } from "../2_tl.js";
|
|
35
|
+
import { as, inputPeerToPeer, is, isOneOf, peerToChatId } from "../2_tl.js";
|
|
36
36
|
import { constructStory, FileType, storyInteractiveAreaToTlObject, storyPrivacyToTlObject } from "../3_types.js";
|
|
37
37
|
import { checkArray, checkStoryId, isHttpUrl } from "./0_utilities.js";
|
|
38
|
+
const storyManagerUpdates = [
|
|
39
|
+
"updateStory",
|
|
40
|
+
];
|
|
38
41
|
export class StoryManager {
|
|
39
42
|
constructor(c) {
|
|
40
43
|
_StoryManager_instances.add(this);
|
|
@@ -123,7 +126,7 @@ export class StoryManager {
|
|
|
123
126
|
await this.removeStoriesFromHighlights(chatId, [storyId]);
|
|
124
127
|
}
|
|
125
128
|
static canHandleUpdate(update) {
|
|
126
|
-
return
|
|
129
|
+
return isOneOf(storyManagerUpdates, update);
|
|
127
130
|
}
|
|
128
131
|
async handleUpdate(update) {
|
|
129
132
|
if (is("storyItemDeleted", update.story)) {
|
package/esm/client/5_client.d.ts
CHANGED
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import { MaybePromise } from "../1_utilities.js";
|
|
21
|
-
import { Api } from "../2_tl.js";
|
|
22
21
|
import { Storage } from "../2_storage.js";
|
|
22
|
+
import { Api } from "../2_tl.js";
|
|
23
23
|
import { DC } from "../3_transport.js";
|
|
24
24
|
import { BotCommand, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatListItem, ChatMember, ChatP, FileSource, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageInvoice, MessageLocation, MessagePhoto, MessagePoll, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Poll, PriceTag, Reaction, Sticker, Story, Update, User, VideoChat, VideoChatActive, VideoChatScheduled } from "../3_types.js";
|
|
25
25
|
import { Migrate } from "../4_errors.js";
|
|
26
|
-
import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, BanChatMemberParams, CreateInviteLinkParams, CreateStoryParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamChunkParams, DownloadParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, JoinVideoChatParams, PinMessageParams, ReplyParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetMyCommandsParams, SetReactionsParams, SignInParams, StartVideoChatParams, StopPollParams } from "./0_params.js";
|
|
26
|
+
import { AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, CreateStoryParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamChunkParams, DownloadParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, JoinVideoChatParams, PinMessageParams, ReplyParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetMyCommandsParams, SetReactionsParams, SignInParams, StartVideoChatParams, StopPollParams } from "./0_params.js";
|
|
27
|
+
import { StorageOperations } from "./0_storage_operations.js";
|
|
27
28
|
import { ClientPlainParams } from "./1_client_plain.js";
|
|
28
29
|
import { Composer as Composer_, NextFunction } from "./1_composer.js";
|
|
29
|
-
import { StorageOperations } from "./0_storage_operations.js";
|
|
30
30
|
export interface Context {
|
|
31
31
|
/** The client that received the update. */
|
|
32
32
|
client: Client;
|
|
@@ -169,6 +169,8 @@ export interface Context {
|
|
|
169
169
|
deleteChatStickerSet: () => Promise<void>;
|
|
170
170
|
/** Context-aware alias for `client.getBusinessConnection()`. */
|
|
171
171
|
getBusinessConnection: () => Promise<BusinessConnection>;
|
|
172
|
+
/** Context-aware alias for `client.answerPreCheckoutQuery()`. */
|
|
173
|
+
answerPreCheckoutQuery: (ok: boolean, params?: AnswerPreCheckoutQueryParams) => Promise<void>;
|
|
172
174
|
}
|
|
173
175
|
export declare class Composer<C extends Context = Context> extends Composer_<C> {
|
|
174
176
|
}
|
|
@@ -882,6 +884,36 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
|
|
|
882
884
|
* @returns The newly created invite link.
|
|
883
885
|
*/
|
|
884
886
|
createInviteLink(chatId: ID, params?: CreateInviteLinkParams): Promise<InviteLink>;
|
|
887
|
+
/**
|
|
888
|
+
* Approve a join request.
|
|
889
|
+
*
|
|
890
|
+
* @method ch
|
|
891
|
+
* @param chatId The identifier of the chat that contains the join request.
|
|
892
|
+
* @param userId The user who made the join request.
|
|
893
|
+
*/
|
|
894
|
+
approveJoinRequest(chatId: ID, userId: ID): Promise<void>;
|
|
895
|
+
/**
|
|
896
|
+
* Decline a join request.
|
|
897
|
+
*
|
|
898
|
+
* @method ch
|
|
899
|
+
* @param chatId The identifier of the chat that contains the join request.
|
|
900
|
+
* @param userId The user who made the join request.
|
|
901
|
+
*/
|
|
902
|
+
declineJoinRequest(chatId: ID, userId: ID): Promise<void>;
|
|
903
|
+
/**
|
|
904
|
+
* Approve all join requests. User-only.
|
|
905
|
+
*
|
|
906
|
+
* @method ch
|
|
907
|
+
* @param chatId The identifier of the chat that contains the join requests.
|
|
908
|
+
*/
|
|
909
|
+
approveJoinRequests(chatId: ID, params?: ApproveJoinRequestsParams): Promise<void>;
|
|
910
|
+
/**
|
|
911
|
+
* Decline all join requests. User-only.
|
|
912
|
+
*
|
|
913
|
+
* @method ch
|
|
914
|
+
* @param chatId The identifier of the chat that contains the join requests.
|
|
915
|
+
*/
|
|
916
|
+
declineJoinRequests(chatId: ID, params?: DeclineJoinRequestsParams): Promise<void>;
|
|
885
917
|
/**
|
|
886
918
|
* Send a callback query. User-only.
|
|
887
919
|
*
|
|
@@ -1168,6 +1200,22 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
|
|
|
1168
1200
|
* @param timestamp Millisecond timestamp of the chunk to download.
|
|
1169
1201
|
*/
|
|
1170
1202
|
downloadLiveStreamChunk(id: string, channelId: number, scale: number, timestamp: number, params?: DownloadLiveStreamChunkParams): AsyncGenerator<Uint8Array, void, unknown>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Answer a pre-checkout query. Bot-only.
|
|
1205
|
+
*
|
|
1206
|
+
* @method pa
|
|
1207
|
+
* @param preCheckoutQueryId The identifier of the pre-checkout query.
|
|
1208
|
+
* @param ok Whether the checkout is going to be processed.
|
|
1209
|
+
*/
|
|
1210
|
+
answerPreCheckoutQuery(preCheckoutQueryId: string, ok: boolean, params?: AnswerPreCheckoutQueryParams): Promise<void>;
|
|
1211
|
+
/**
|
|
1212
|
+
* Refund a star payment. Bot-only.
|
|
1213
|
+
*
|
|
1214
|
+
* @method pa
|
|
1215
|
+
* @param userId The identifier of the user that was charged.
|
|
1216
|
+
* @param telegramPaymentChargeId The identifier of the charge.
|
|
1217
|
+
*/
|
|
1218
|
+
refundStarPayment(userId: ID, telegramPaymentChargeId: string): Promise<void>;
|
|
1171
1219
|
}
|
|
1172
1220
|
export {};
|
|
1173
1221
|
//# sourceMappingURL=5_client.d.ts.map
|