@mtkruto/node 0.1.142 → 0.1.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ 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");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ 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");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _BotInfoManager_instances, _BotInfoManager_c, _BotInfoManager_setMyInfo, _BotInfoManager_getMyInfo;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BotInfoManager = void 0;
16
+ const _2_tl_js_1 = require("../2_tl.js");
17
+ const _3_types_js_1 = require("../3_types.js");
18
+ class BotInfoManager {
19
+ constructor(c) {
20
+ _BotInfoManager_instances.add(this);
21
+ _BotInfoManager_c.set(this, void 0);
22
+ __classPrivateFieldSet(this, _BotInfoManager_c, c, "f");
23
+ }
24
+ async setMyDescription(params) {
25
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyDescription");
26
+ await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { description: params?.description, lang_code: params?.languageCode ?? "" });
27
+ }
28
+ async setMyName(params) {
29
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyName");
30
+ await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { name: params?.name, lang_code: params?.languageCode ?? "" });
31
+ }
32
+ async setMyShortDescription(params) {
33
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyShortDescription");
34
+ await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { about: params?.shortDescription, lang_code: params?.languageCode ?? "" });
35
+ }
36
+ async getMyDescription(params) {
37
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyDescription");
38
+ return await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode).then((v) => v.description);
39
+ }
40
+ async getMyName(params) {
41
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyName");
42
+ return await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode).then((v) => v.description);
43
+ }
44
+ async getMyShortDescription(params) {
45
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyShortDescription");
46
+ return await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode).then((v) => v.about);
47
+ }
48
+ async getMyCommands(params) {
49
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyCommands");
50
+ const commands_ = await __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.getBotCommands({
51
+ lang_code: params?.languageCode ?? "",
52
+ scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, __classPrivateFieldGet(this, _BotInfoManager_c, "f").getInputPeer),
53
+ });
54
+ return commands_.map((v) => ({ command: v.command, description: v.description }));
55
+ }
56
+ async setMyCommands(commands, params) {
57
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyCommands");
58
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.setBotCommands({
59
+ commands: commands.map((v) => new _2_tl_js_1.types.BotCommand(v)),
60
+ lang_code: params?.languageCode ?? "",
61
+ scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, __classPrivateFieldGet(this, _BotInfoManager_c, "f").getInputPeer),
62
+ });
63
+ }
64
+ }
65
+ exports.BotInfoManager = BotInfoManager;
66
+ _BotInfoManager_c = new WeakMap(), _BotInfoManager_instances = new WeakSet(), _BotInfoManager_setMyInfo = async function _BotInfoManager_setMyInfo(info) {
67
+ await __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.setBotInfo({ bot: new _2_tl_js_1.types.InputUserSelf(), ...info });
68
+ }, _BotInfoManager_getMyInfo = function _BotInfoManager_getMyInfo(languageCode) {
69
+ return __classPrivateFieldGet(this, _BotInfoManager_c, "f").api.bots.getBotInfo({ bot: new _2_tl_js_1.types.InputUserSelf(), lang_code: languageCode ?? "" });
70
+ };
@@ -0,0 +1,19 @@
1
+ import { C } from "./0_types.js";
2
+ export declare class NetworkStatisticsManager {
3
+ #private;
4
+ constructor(c: C);
5
+ getNetworkStatistics(): Promise<{
6
+ messages: {
7
+ sent: number;
8
+ received: number;
9
+ };
10
+ cdn: {
11
+ sent: number;
12
+ received: number;
13
+ };
14
+ }>;
15
+ getTransportReadWriteCallback(): {
16
+ read: (count: number) => Promise<void>;
17
+ write: (count: number) => Promise<void>;
18
+ };
19
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ 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");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ 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");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _NetworkStatisticsManager_c;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.NetworkStatisticsManager = void 0;
16
+ class NetworkStatisticsManager {
17
+ constructor(c) {
18
+ _NetworkStatisticsManager_c.set(this, void 0);
19
+ __classPrivateFieldSet(this, _NetworkStatisticsManager_c, c, "f");
20
+ }
21
+ async getNetworkStatistics() {
22
+ const [messagesRead, messagesWrite, cdnRead, cdnWrite] = await Promise.all([
23
+ __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_messages_read"]),
24
+ __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_messages_write"]),
25
+ __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_cdn_read"]),
26
+ __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_cdn_write"]),
27
+ ]);
28
+ const messages = {
29
+ sent: Number(messagesWrite || 0),
30
+ received: Number(messagesRead || 0),
31
+ };
32
+ const cdn = {
33
+ sent: Number(cdnWrite || 0),
34
+ received: Number(cdnRead || 0),
35
+ };
36
+ return { messages, cdn };
37
+ }
38
+ getTransportReadWriteCallback() {
39
+ return {
40
+ read: async (count) => {
41
+ const key = __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").cdn ? "netstat_cdn_read" : "netstat_messages_read";
42
+ await __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.incr([key], count);
43
+ },
44
+ write: async (count) => {
45
+ const key = __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").cdn ? "netstat_cdn_write" : "netstat_messages_write";
46
+ await __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.incr([key], count);
47
+ },
48
+ };
49
+ }
50
+ }
51
+ exports.NetworkStatisticsManager = NetworkStatisticsManager;
52
+ _NetworkStatisticsManager_c = new WeakMap();
@@ -1,6 +1,6 @@
1
1
  import { enums, types } from "../2_tl.js";
2
- import { FileSource, ID, Message, MessageEntity, ParseMode, Reaction, Update, UsernameResolver } from "../3_types.js";
3
- import { DeleteMessagesParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetHistoryParams, PinMessageParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams } from "./0_params.js";
2
+ import { ChatAction, FileSource, ID, Message, MessageEntity, ParseMode, Reaction, Update, UsernameResolver } from "../3_types.js";
3
+ import { BanChatMemberParams, DeleteMessagesParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetHistoryParams, PinMessageParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendLocationParams, SendMessageParams, SendPhotoParams, SendPollParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams } from "./0_params.js";
4
4
  import { AddReactionParams, SetReactionsParams } from "./0_params.js";
5
5
  import { C as C_ } from "./0_types.js";
6
6
  import { FileManager } from "./1_file_manager.js";
@@ -48,5 +48,13 @@ export declare class MessageManager {
48
48
  removeReaction(chatId: number, messageId: number, reaction: Reaction): Promise<void>;
49
49
  static canHandleUpdate(update: enums.Update): update is types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages;
50
50
  handleUpdate(update: types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages): Promise<Update | null>;
51
+ sendChatAction(chatId: ID, action: ChatAction, params?: {
52
+ messageThreadId?: number;
53
+ }): Promise<void>;
54
+ deleteChatPhoto(chatId: number): Promise<void>;
55
+ setChatPhoto(chatId: number, photo: FileSource, params?: SetChatPhotoParams): Promise<void>;
56
+ banChatMember(chatId: ID, memberId: ID, params?: BanChatMemberParams): Promise<void>;
57
+ unbanChatMember(chatId: ID, memberId: ID): Promise<void>;
58
+ setChatMemberRights(chatId: ID, memberId: ID, params?: SetChatMemberRightsParams): Promise<void>;
51
59
  }
52
60
  export {};
@@ -590,6 +590,159 @@ class MessageManager {
590
590
  }
591
591
  return null;
592
592
  }
593
+ async sendChatAction(chatId, action, params) {
594
+ let action_;
595
+ switch (action) {
596
+ case "type":
597
+ action_ = new _2_tl_js_1.types.SendMessageTypingAction();
598
+ break;
599
+ case "uploadPhoto":
600
+ action_ = new _2_tl_js_1.types.SendMessageUploadPhotoAction({ progress: 0 });
601
+ break;
602
+ case "recordVideo":
603
+ action_ = new _2_tl_js_1.types.SendMessageRecordVideoAction();
604
+ break;
605
+ case "uploadVideo":
606
+ action_ = new _2_tl_js_1.types.SendMessageRecordVideoAction();
607
+ break;
608
+ case "recordVoice":
609
+ action_ = new _2_tl_js_1.types.SendMessageRecordAudioAction();
610
+ break;
611
+ case "uploadAudio":
612
+ action_ = new _2_tl_js_1.types.SendMessageUploadAudioAction({ progress: 0 });
613
+ break;
614
+ case "uploadDocument":
615
+ action_ = new _2_tl_js_1.types.SendMessageUploadDocumentAction({ progress: 0 });
616
+ break;
617
+ case "chooseSticker":
618
+ action_ = new _2_tl_js_1.types.SendMessageChooseStickerAction();
619
+ break;
620
+ case "findLocation":
621
+ action_ = new _2_tl_js_1.types.SendMessageGeoLocationAction();
622
+ break;
623
+ case "recordVideoNote":
624
+ action_ = new _2_tl_js_1.types.SendMessageRecordRoundAction();
625
+ break;
626
+ case "uploadVideoNote":
627
+ action_ = new _2_tl_js_1.types.SendMessageUploadRoundAction({ progress: 0 });
628
+ break;
629
+ default:
630
+ throw new Error("Invalid chat action: " + action);
631
+ }
632
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.setTyping({ peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), action: action_, top_msg_id: params?.messageThreadId });
633
+ }
634
+ async deleteChatPhoto(chatId) {
635
+ const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
636
+ if (!(peer instanceof _2_tl_js_1.types.InputPeerChannel) && !(peer instanceof _2_tl_js_1.types.InputPeerChat)) {
637
+ (0, _1_utilities_js_1.UNREACHABLE)();
638
+ }
639
+ if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
640
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editPhoto({ channel: new _2_tl_js_1.types.InputChannel(peer), photo: new _2_tl_js_1.types.InputChatPhotoEmpty() });
641
+ }
642
+ else if (peer instanceof _2_tl_js_1.types.InputPeerChat) {
643
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editChatPhoto({ chat_id: peer.chat_id, photo: new _2_tl_js_1.types.InputChatPhotoEmpty() });
644
+ }
645
+ }
646
+ async setChatPhoto(chatId, photo, params) {
647
+ const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
648
+ if (!(peer instanceof _2_tl_js_1.types.InputPeerChannel) && !(peer instanceof _2_tl_js_1.types.InputPeerChat)) {
649
+ (0, _1_utilities_js_1.UNREACHABLE)();
650
+ }
651
+ const [contents, fileName] = await (0, _0_utilities_js_1.getFileContents)(photo);
652
+ const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName: params?.fileName ?? fileName, chunkSize: params?.chunkSize, signal: params?.signal });
653
+ const photo_ = new _2_tl_js_1.types.InputChatUploadedPhoto({ file });
654
+ if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
655
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editPhoto({ channel: new _2_tl_js_1.types.InputChannel(peer), photo: photo_ });
656
+ }
657
+ else if (peer instanceof _2_tl_js_1.types.InputPeerChat) {
658
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editChatPhoto({ chat_id: peer.chat_id, photo: photo_ });
659
+ }
660
+ }
661
+ async banChatMember(chatId, memberId, params) {
662
+ const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
663
+ if (!(chat instanceof _2_tl_js_1.types.InputPeerChannel) && !(chat instanceof _2_tl_js_1.types.InputPeerChat)) {
664
+ throw new Error("Invalid chat ID");
665
+ }
666
+ const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
667
+ if (chat instanceof _2_tl_js_1.types.InputPeerChannel) {
668
+ if (params?.deleteMessages) {
669
+ try {
670
+ await this.deleteChatMemberMessages(chatId, memberId);
671
+ }
672
+ catch {
673
+ //
674
+ }
675
+ }
676
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editBanned({
677
+ channel: new _2_tl_js_1.types.InputChannel(chat),
678
+ participant: member,
679
+ banned_rights: new _2_tl_js_1.types.ChatBannedRights({
680
+ until_date: params?.untilDate ? (0, _1_utilities_js_1.toUnixTimestamp)(params.untilDate) : 0,
681
+ view_messages: true,
682
+ send_messages: true,
683
+ send_media: true,
684
+ send_stickers: true,
685
+ send_gifs: true,
686
+ send_games: true,
687
+ send_inline: true,
688
+ embed_links: true,
689
+ }),
690
+ });
691
+ }
692
+ else if (chat instanceof _2_tl_js_1.types.InputPeerChat) {
693
+ if (!(member instanceof _2_tl_js_1.types.InputPeerUser)) {
694
+ throw new Error("Invalid user ID");
695
+ }
696
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.deleteChatUser({
697
+ chat_id: chat.chat_id,
698
+ user_id: new _2_tl_js_1.types.InputUser(member),
699
+ revoke_history: params?.deleteMessages ? true : undefined,
700
+ });
701
+ }
702
+ }
703
+ async unbanChatMember(chatId, memberId) {
704
+ const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
705
+ if (!(chat instanceof _2_tl_js_1.types.InputPeerChannel)) {
706
+ throw new Error("Invalid chat ID");
707
+ }
708
+ const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
709
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editBanned({
710
+ channel: new _2_tl_js_1.types.InputChannel(chat),
711
+ participant: member,
712
+ banned_rights: new _2_tl_js_1.types.ChatBannedRights({ until_date: 0 }),
713
+ });
714
+ }
715
+ async setChatMemberRights(chatId, memberId, params) {
716
+ const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
717
+ if (!(chat instanceof _2_tl_js_1.types.InputPeerChannel)) {
718
+ throw new Error("Invalid chat ID");
719
+ }
720
+ const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
721
+ await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editBanned({
722
+ channel: new _2_tl_js_1.types.InputChannel(chat),
723
+ participant: member,
724
+ banned_rights: new _2_tl_js_1.types.ChatBannedRights({
725
+ until_date: params?.untilDate ? (0, _1_utilities_js_1.toUnixTimestamp)(params.untilDate) : 0,
726
+ send_messages: params?.rights?.canSendMessages ? true : undefined,
727
+ send_audios: params?.rights?.canSendAudio ? true : undefined,
728
+ send_docs: params?.rights?.canSendDocuments ? true : undefined,
729
+ send_photos: params?.rights?.canSendPhotos ? true : undefined,
730
+ send_videos: params?.rights?.canSendVideos ? true : undefined,
731
+ send_roundvideos: params?.rights?.canSendVideoNotes ? true : undefined,
732
+ send_voices: params?.rights?.canSendVoice ? true : undefined,
733
+ send_polls: params?.rights?.canSendPolls ? true : undefined,
734
+ send_stickers: params?.rights?.canSendStickers ? true : undefined,
735
+ send_gifs: params?.rights?.canSendAnimations ? true : undefined,
736
+ send_games: params?.rights?.canSendGames ? true : undefined,
737
+ send_inline: params?.rights?.canSendInlineBotResults ? true : undefined,
738
+ embed_links: params?.rights?.canAddWebPagePreviews ? true : undefined,
739
+ change_info: params?.rights?.canChangeInfo ? true : undefined,
740
+ invite_users: params?.rights?.canInviteUsers ? true : undefined,
741
+ pin_messages: params?.rights?.canPinMessages ? true : undefined,
742
+ manage_topics: params?.rights?.canManageTopics ? true : undefined,
743
+ }),
744
+ });
745
+ }
593
746
  }
594
747
  exports.MessageManager = MessageManager;
595
748
  _MessageManager_c = new WeakMap(), _MessageManager_instances = new WeakSet(), _MessageManager_updatesToMessages = async function _MessageManager_updatesToMessages(chatId, updates) {
@@ -33,7 +33,7 @@ class CallbackQueryManager {
33
33
  return update instanceof _2_tl_js_1.types.UpdateBotCallbackQuery || update instanceof _2_tl_js_1.types.UpdateInlineBotCallbackQuery;
34
34
  }
35
35
  async handleUpdate(update) {
36
- return { callbackQuery: await (0, _3_types_js_1.constructCallbackQuery)(update, __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").getEntity, __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").messageManager.getMessageWithReply.bind(this)) };
36
+ return { callbackQuery: await (0, _3_types_js_1.constructCallbackQuery)(update, __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").getEntity, __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").messageManager.getMessageWithReply.bind(__classPrivateFieldGet(this, _CallbackQueryManager_c, "f").messageManager)) };
37
37
  }
38
38
  }
39
39
  exports.CallbackQueryManager = CallbackQueryManager;
@@ -22,9 +22,10 @@ class InlineQueryManager {
22
22
  __classPrivateFieldSet(this, _InlineQueryManager_c, c, "f");
23
23
  }
24
24
  async answerInlineQuery(id, results, params) {
25
+ await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").storage.assertBot("answerInlineQuery");
25
26
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").api.messages.setInlineBotResults({
26
27
  query_id: BigInt(id),
27
- results: await Promise.all(results.map((v) => (0, _3_types_js_1.inlineQueryResultToTlObject)(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(this), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(this)))),
28
+ results: await Promise.all(results.map((v) => (0, _3_types_js_1.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)))),
28
29
  cache_time: params?.cacheTime ?? 300,
29
30
  private: params?.isPersonal ? true : undefined,
30
31
  switch_webview: params?.button && params.button.webApp ? new _2_tl_js_1.types.InlineBotWebView({ text: params.button.text, url: params.button.webApp.url }) : undefined,
@@ -84,9 +84,9 @@ export interface Context {
84
84
  editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<MessageText>;
85
85
  /** Edit the reply markup of a message in the chat which the message was received from. */
86
86
  editMessageReplyMarkup: (messageId: number, params?: EditMessageReplyMarkupParams) => Promise<Message>;
87
- /** Answer the received callback query. */
87
+ /** Answer the received callback query. Bot-only. */
88
88
  answerCallbackQuery: (params?: AnswerCallbackQueryParams) => Promise<void>;
89
- /** Answer the received inline query. */
89
+ /** Answer the received inline query. Bot-only */
90
90
  answerInlineQuery: (results: InlineQueryResult[], params?: AnswerInlineQueryParams) => Promise<void>;
91
91
  /** Retrieve a single message of the chat which the message was received from. */
92
92
  getMessage: (messageId: number) => Promise<Message | null>;
@@ -236,6 +236,15 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
236
236
  private [getEntity];
237
237
  private [getEntity];
238
238
  private [getEntity];
239
+ use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
240
+ branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
241
+ filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
242
+ filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
243
+ on<Q extends FilterQuery>(filter: Q, ...middleawre: Middleware<WithFilter<C, Q>>[]): Composer<UpdateIntersection<WithFilter<C, Q>>>;
244
+ command(commands: string | RegExp | (string | RegExp)[] | {
245
+ names: string | RegExp | (string | RegExp)[];
246
+ prefixes: string | string[];
247
+ }, ...middleawre: Middleware<WithFilter<C, "message:text">>[]): Composer<UpdateIntersection<WithFilter<C, "message:text">>>;
239
248
  /**
240
249
  * Send a text message.
241
250
  *
@@ -327,15 +336,6 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
327
336
  * @method
328
337
  */
329
338
  getMe(): Promise<User>;
330
- use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
331
- branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
332
- filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
333
- filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
334
- on<Q extends FilterQuery>(filter: Q, ...middleawre: Middleware<WithFilter<C, Q>>[]): Composer<UpdateIntersection<WithFilter<C, Q>>>;
335
- command(commands: string | RegExp | (string | RegExp)[] | {
336
- names: string | RegExp | (string | RegExp)[];
337
- prefixes: string | string[];
338
- }, ...middleawre: Middleware<WithFilter<C, "message:text">>[]): Composer<UpdateIntersection<WithFilter<C, "message:text">>>;
339
339
  /**
340
340
  * Answer a callback query. Bot-only.
341
341
  *