@mtkruto/node 0.1.142 → 0.1.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/3_types.d.ts +1 -0
- package/esm/3_types.js +1 -0
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/client/0_message.js +9 -9
- package/esm/client/0_types.d.ts +1 -0
- package/esm/client/1_bot_info_manager.d.ts +30 -0
- package/esm/client/1_bot_info_manager.js +66 -0
- package/esm/client/1_file_manager.js +1 -1
- package/esm/client/1_network_statistics_manager.d.ts +19 -0
- package/esm/client/1_network_statistics_manager.js +48 -0
- package/esm/client/2_client_plain.js +4 -4
- package/esm/client/2_message_manager.d.ts +11 -2
- package/esm/client/2_message_manager.js +170 -1
- package/esm/client/3_callback_query_manager.js +1 -1
- package/esm/client/3_inline_query_manager.js +2 -1
- package/esm/client/4_client.d.ts +21 -12
- package/esm/client/4_client.js +134 -311
- package/esm/storage/0_storage.js +1 -1
- package/esm/tl/0_tl_raw_reader.js +3 -2
- package/esm/tl/0_tl_raw_writer.js +3 -3
- package/esm/transport/0_obfuscation.js +2 -2
- package/esm/transport/1_transport_abridged.js +1 -1
- package/esm/transport/1_transport_intermediate.js +1 -1
- package/esm/types/0__file_id.js +2 -2
- package/esm/types/0_chat_member_rights.d.ts +3 -0
- package/esm/types/0_chat_member_rights.js +45 -1
- package/esm/types/2_chat_member.d.ts +46 -0
- package/esm/types/2_chat_member.js +89 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +1 -0
- package/script/3_types.js +1 -0
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/client/0_message.js +9 -9
- package/script/client/0_types.d.ts +1 -0
- package/script/client/1_bot_info_manager.d.ts +30 -0
- package/script/client/1_bot_info_manager.js +70 -0
- package/script/client/1_file_manager.js +1 -1
- package/script/client/1_network_statistics_manager.d.ts +19 -0
- package/script/client/1_network_statistics_manager.js +52 -0
- package/script/client/2_client_plain.js +4 -4
- package/script/client/2_message_manager.d.ts +11 -2
- package/script/client/2_message_manager.js +169 -0
- package/script/client/3_callback_query_manager.js +1 -1
- package/script/client/3_inline_query_manager.js +2 -1
- package/script/client/4_client.d.ts +21 -12
- package/script/client/4_client.js +131 -308
- package/script/storage/0_storage.js +1 -1
- package/script/tl/0_tl_raw_reader.js +3 -2
- package/script/tl/0_tl_raw_writer.js +3 -3
- package/script/transport/0_obfuscation.js +2 -2
- package/script/transport/1_transport_abridged.js +1 -1
- package/script/transport/1_transport_intermediate.js +1 -1
- package/script/types/0__file_id.js +2 -2
- package/script/types/0_chat_member_rights.d.ts +3 -0
- package/script/types/0_chat_member_rights.js +48 -0
- package/script/types/2_chat_member.d.ts +46 -0
- package/script/types/2_chat_member.js +93 -0
|
@@ -590,6 +590,175 @@ 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: (0, _3_types_js_1.chatMemberRightsToTlObject)(params?.rights, params?.untilDate),
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
async getChatAdministrators(chatId) {
|
|
728
|
+
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
729
|
+
if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
|
|
730
|
+
const channel = new _2_tl_js_1.types.InputChannel(peer);
|
|
731
|
+
const participants = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.getParticipants({
|
|
732
|
+
channel,
|
|
733
|
+
filter: new _2_tl_js_1.types.ChannelParticipantsAdmins(),
|
|
734
|
+
offset: 0,
|
|
735
|
+
limit: 100,
|
|
736
|
+
hash: 0n,
|
|
737
|
+
});
|
|
738
|
+
if (participants instanceof _2_tl_js_1.types.channels.ChannelParticipantsNotModified) {
|
|
739
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
740
|
+
}
|
|
741
|
+
const chatMembers = new Array();
|
|
742
|
+
for (const p of participants.participants) {
|
|
743
|
+
chatMembers.push(await (0, _3_types_js_1.constructChatMember)(p, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity));
|
|
744
|
+
}
|
|
745
|
+
return chatMembers;
|
|
746
|
+
}
|
|
747
|
+
else if (peer instanceof _2_tl_js_1.types.InputPeerChat) {
|
|
748
|
+
const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.getFullChat(peer); // TODO: full chat cache
|
|
749
|
+
if (!(fullChat.full_chat instanceof _2_tl_js_1.types.ChatFull) || !(fullChat.full_chat.participants instanceof _2_tl_js_1.types.ChatParticipants)) {
|
|
750
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
751
|
+
}
|
|
752
|
+
const chatMembers = new Array();
|
|
753
|
+
for (const p of fullChat.full_chat.participants.participants) {
|
|
754
|
+
chatMembers.push(await (0, _3_types_js_1.constructChatMember)(p, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity));
|
|
755
|
+
}
|
|
756
|
+
return chatMembers;
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
760
|
+
}
|
|
761
|
+
}
|
|
593
762
|
}
|
|
594
763
|
exports.MessageManager = MessageManager;
|
|
595
764
|
_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,
|
|
@@ -2,7 +2,7 @@ import { MaybePromise } from "../1_utilities.js";
|
|
|
2
2
|
import { functions, types } from "../2_tl.js";
|
|
3
3
|
import { Storage } from "../3_storage.js";
|
|
4
4
|
import { DC } from "../3_transport.js";
|
|
5
|
-
import { BotCommand, Chat, ChatAction, ChatP, Document, FileSource, ID, InlineQueryResult, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Reaction, Update, UpdateIntersection, User } from "../3_types.js";
|
|
5
|
+
import { BotCommand, Chat, ChatAction, ChatMember, ChatP, Document, FileSource, ID, InlineQueryResult, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageLocation, MessagePhoto, MessagePoll, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Reaction, Update, UpdateIntersection, User } from "../3_types.js";
|
|
6
6
|
import { Migrate } from "../4_errors.js";
|
|
7
7
|
import { ClientAbstract } from "./0_client_abstract.js";
|
|
8
8
|
import { FilterQuery, WithFilter } from "./0_filters.js";
|
|
@@ -74,6 +74,8 @@ export interface Context {
|
|
|
74
74
|
kickSender: () => Promise<void>;
|
|
75
75
|
/** Set the rights of the received message. */
|
|
76
76
|
setSenderRights: (params?: SetChatMemberRightsParams) => Promise<void>;
|
|
77
|
+
/** Get the administrators of the chat which the message was received from. */
|
|
78
|
+
getChatAdministrators: () => Promise<ChatMember[]>;
|
|
77
79
|
/** Change the reactions made to the received message. */
|
|
78
80
|
react: (reactions: Reaction[], params?: SetReactionsParams) => Promise<void>;
|
|
79
81
|
/** Send a chat action to the chat which the message was received from. */
|
|
@@ -84,9 +86,9 @@ export interface Context {
|
|
|
84
86
|
editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<MessageText>;
|
|
85
87
|
/** Edit the reply markup of a message in the chat which the message was received from. */
|
|
86
88
|
editMessageReplyMarkup: (messageId: number, params?: EditMessageReplyMarkupParams) => Promise<Message>;
|
|
87
|
-
/** Answer the received callback query. */
|
|
89
|
+
/** Answer the received callback query. Bot-only. */
|
|
88
90
|
answerCallbackQuery: (params?: AnswerCallbackQueryParams) => Promise<void>;
|
|
89
|
-
/** Answer the received inline query. */
|
|
91
|
+
/** Answer the received inline query. Bot-only */
|
|
90
92
|
answerInlineQuery: (results: InlineQueryResult[], params?: AnswerInlineQueryParams) => Promise<void>;
|
|
91
93
|
/** Retrieve a single message of the chat which the message was received from. */
|
|
92
94
|
getMessage: (messageId: number) => Promise<Message | null>;
|
|
@@ -236,6 +238,15 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
|
|
|
236
238
|
private [getEntity];
|
|
237
239
|
private [getEntity];
|
|
238
240
|
private [getEntity];
|
|
241
|
+
use(...middleware: Middleware<UpdateIntersection<C>>[]): Composer<UpdateIntersection<C>>;
|
|
242
|
+
branch(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, trueHandler_: Middleware<UpdateIntersection<C>>, falseHandler_: Middleware<UpdateIntersection<C>>): Composer<UpdateIntersection<C>>;
|
|
243
|
+
filter<D extends C>(predicate: (ctx: UpdateIntersection<C>) => ctx is D, ...middleware: Middleware<D>[]): Composer<D>;
|
|
244
|
+
filter(predicate: (ctx: UpdateIntersection<C>) => MaybePromise<boolean>, ...middleware: Middleware<UpdateIntersection<C>>[]): Composer<C>;
|
|
245
|
+
on<Q extends FilterQuery>(filter: Q, ...middleawre: Middleware<WithFilter<C, Q>>[]): Composer<UpdateIntersection<WithFilter<C, Q>>>;
|
|
246
|
+
command(commands: string | RegExp | (string | RegExp)[] | {
|
|
247
|
+
names: string | RegExp | (string | RegExp)[];
|
|
248
|
+
prefixes: string | string[];
|
|
249
|
+
}, ...middleawre: Middleware<WithFilter<C, "message:text">>[]): Composer<UpdateIntersection<WithFilter<C, "message:text">>>;
|
|
239
250
|
/**
|
|
240
251
|
* Send a text message.
|
|
241
252
|
*
|
|
@@ -327,15 +338,6 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
|
|
|
327
338
|
* @method
|
|
328
339
|
*/
|
|
329
340
|
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
341
|
/**
|
|
340
342
|
* Answer a callback query. Bot-only.
|
|
341
343
|
*
|
|
@@ -694,5 +696,12 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
|
|
|
694
696
|
* @param memberId The identifier of a member.
|
|
695
697
|
*/
|
|
696
698
|
setChatMemberRights(chatId: ID, memberId: ID, params?: SetChatMemberRightsParams): Promise<void>;
|
|
699
|
+
/**
|
|
700
|
+
* Get the administrators of a chat.
|
|
701
|
+
*
|
|
702
|
+
* @method
|
|
703
|
+
* @param chatId The identifier of the chat.
|
|
704
|
+
*/
|
|
705
|
+
getChatAdministrators(chatId: ID): Promise<ChatMember[]>;
|
|
697
706
|
}
|
|
698
707
|
export {};
|