@mtkruto/node 0.14.0 → 0.15.1
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 +4 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +4 -0
- package/esm/client/0_params.d.ts +16 -2
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_update_processor.d.ts +7 -0
- package/esm/client/0_update_processor.d.ts.map +1 -0
- package/esm/client/0_update_processor.js +1 -0
- package/esm/client/2_business_connection_manager.d.ts +3 -2
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +1 -1
- package/esm/client/2_gift_manager.d.ts +29 -0
- package/esm/client/2_gift_manager.d.ts.map +1 -0
- package/esm/client/2_gift_manager.js +62 -0
- package/esm/client/2_payment_manager.d.ts +3 -2
- package/esm/client/2_payment_manager.d.ts.map +1 -1
- package/esm/client/2_payment_manager.js +1 -1
- package/esm/client/2_reaction_manager.d.ts +3 -2
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +1 -1
- package/esm/client/2_translations_manager.d.ts +3 -2
- package/esm/client/2_translations_manager.d.ts.map +1 -1
- package/esm/client/2_translations_manager.js +1 -1
- package/esm/client/3_message_manager.d.ts +8 -25
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +26 -238
- package/esm/client/3_video_chat_manager.d.ts +3 -2
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +1 -1
- package/esm/client/4_callback_query_manager.d.ts +3 -2
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +1 -1
- package/esm/client/4_chat_list_manager.d.ts +4 -3
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +2 -1
- package/esm/client/4_chat_manager.d.ts +61 -0
- package/esm/client/4_chat_manager.d.ts.map +1 -0
- package/esm/client/4_chat_manager.js +293 -0
- package/esm/client/4_inline_query_manager.d.ts +3 -2
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +1 -1
- package/esm/client/4_poll_manager.d.ts +3 -2
- package/esm/client/4_poll_manager.d.ts.map +1 -1
- package/esm/client/4_poll_manager.js +1 -1
- package/esm/client/4_story_manager.d.ts +3 -2
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +1 -1
- package/esm/client/5_client.d.ts +33 -6
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +163 -71
- package/esm/types/1_sticker.d.ts +1 -0
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +6 -2
- package/esm/types/2_gift_upgraded_component.d.ts +95 -0
- package/esm/types/2_gift_upgraded_component.d.ts.map +1 -0
- package/esm/types/2_gift_upgraded_component.js +88 -0
- package/esm/types/3_gift.d.ts +84 -0
- package/esm/types/3_gift.d.ts.map +1 -0
- package/esm/types/3_gift.js +90 -0
- package/esm/types/4_user_gift.d.ts +44 -0
- package/esm/types/4_user_gift.d.ts.map +1 -0
- package/esm/types/4_user_gift.js +43 -0
- package/esm/types/5_user_gifts.d.ts +32 -0
- package/esm/types/5_user_gifts.d.ts.map +1 -0
- package/esm/types/5_user_gifts.js +29 -0
- package/package.json +1 -1
- package/script/3_types.d.ts +4 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +4 -0
- package/script/client/0_params.d.ts +16 -2
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_update_processor.d.ts +7 -0
- package/script/client/0_update_processor.d.ts.map +1 -0
- package/script/client/0_update_processor.js +2 -0
- package/script/client/2_business_connection_manager.d.ts +3 -2
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +1 -1
- package/script/client/2_gift_manager.d.ts +29 -0
- package/script/client/2_gift_manager.d.ts.map +1 -0
- package/script/client/2_gift_manager.js +66 -0
- package/script/client/2_payment_manager.d.ts +3 -2
- package/script/client/2_payment_manager.d.ts.map +1 -1
- package/script/client/2_payment_manager.js +1 -1
- package/script/client/2_reaction_manager.d.ts +3 -2
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +1 -1
- package/script/client/2_translations_manager.d.ts +3 -2
- package/script/client/2_translations_manager.d.ts.map +1 -1
- package/script/client/2_translations_manager.js +1 -1
- package/script/client/3_message_manager.d.ts +8 -25
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +23 -235
- package/script/client/3_video_chat_manager.d.ts +3 -2
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +1 -1
- package/script/client/4_callback_query_manager.d.ts +3 -2
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +1 -1
- package/script/client/4_chat_list_manager.d.ts +4 -3
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +2 -1
- package/script/client/4_chat_manager.d.ts +61 -0
- package/script/client/4_chat_manager.d.ts.map +1 -0
- package/script/client/4_chat_manager.js +297 -0
- package/script/client/4_inline_query_manager.d.ts +3 -2
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +1 -1
- package/script/client/4_poll_manager.d.ts +3 -2
- package/script/client/4_poll_manager.d.ts.map +1 -1
- package/script/client/4_poll_manager.js +1 -1
- package/script/client/4_story_manager.d.ts +3 -2
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +1 -1
- package/script/client/5_client.d.ts +33 -6
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +163 -71
- package/script/types/1_sticker.d.ts +1 -0
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +7 -2
- package/script/types/2_gift_upgraded_component.d.ts +95 -0
- package/script/types/2_gift_upgraded_component.d.ts.map +1 -0
- package/script/types/2_gift_upgraded_component.js +91 -0
- package/script/types/3_gift.d.ts +84 -0
- package/script/types/3_gift.d.ts.map +1 -0
- package/script/types/3_gift.js +95 -0
- package/script/types/4_user_gift.d.ts +44 -0
- package/script/types/4_user_gift.d.ts.map +1 -0
- package/script/types/4_user_gift.js +46 -0
- package/script/types/5_user_gifts.d.ts +32 -0
- package/script/types/5_user_gifts.d.ts.map +1 -0
- package/script/types/5_user_gifts.js +32 -0
|
@@ -28,17 +28,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
28
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
29
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
30
|
};
|
|
31
|
-
var _MessageManager_instances, _a, _MessageManager_c, _MessageManager_LresolveFileId, _MessageManager_checkParams, _MessageManager_updatesToMessages, _MessageManager_constructReplyMarkup, _MessageManager_resolveSendAs, _MessageManager_constructReplyTo, _MessageManager_sendDocumentInner, _MessageManager_sendMedia, _MessageManager_CAPTIONABLE_MESSAGE_TYPES, _MessageManager_resolveInputMediaInner, _MessageManager_resolveInputMedia, _MessageManager_sendReaction
|
|
31
|
+
var _MessageManager_instances, _a, _MessageManager_c, _MessageManager_LresolveFileId, _MessageManager_checkParams, _MessageManager_updatesToMessages, _MessageManager_constructReplyMarkup, _MessageManager_resolveSendAs, _MessageManager_constructReplyTo, _MessageManager_sendDocumentInner, _MessageManager_sendMedia, _MessageManager_CAPTIONABLE_MESSAGE_TYPES, _MessageManager_editInlineMessageTextInner, _MessageManager_resolveInputMediaInner, _MessageManager_resolveInputMedia, _MessageManager_sendReaction;
|
|
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
35
|
import { as, getChannelChatId, is, isOneOf, peerToChatId } from "../2_tl.js";
|
|
36
|
-
import {
|
|
37
|
-
import { assertMessageType,
|
|
36
|
+
import { deserializeFileId, isMessageType, selfDestructOptionToInt } from "../3_types.js";
|
|
37
|
+
import { assertMessageType, 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";
|
|
40
40
|
import { parseMarkdown } from "./0_markdown.js";
|
|
41
|
-
import { canBeInputChannel,
|
|
41
|
+
import { canBeInputChannel, checkArray, checkMessageId, isHttpUrl, toInputChannel } from "./0_utilities.js";
|
|
42
42
|
const FALLBACK_MIME_TYPE = "application/octet-stream";
|
|
43
43
|
const STICKER_MIME_TYPES = ["image/webp", "video/webm", "application/x-tgsticker"];
|
|
44
44
|
const messageManagerUpdates = [
|
|
@@ -53,9 +53,6 @@ const messageManagerUpdates = [
|
|
|
53
53
|
"updateDeleteMessages",
|
|
54
54
|
"updateDeleteChannelMessages",
|
|
55
55
|
"updateDeleteScheduledMessages",
|
|
56
|
-
"updateChannelParticipant",
|
|
57
|
-
"updateChatParticipant",
|
|
58
|
-
"updateBotChatInviteRequester",
|
|
59
56
|
];
|
|
60
57
|
export class MessageManager {
|
|
61
58
|
constructor(c) {
|
|
@@ -584,6 +581,9 @@ export class MessageManager {
|
|
|
584
581
|
}
|
|
585
582
|
}
|
|
586
583
|
const [message, entities] = await this.parseText(text, params);
|
|
584
|
+
if (!message) {
|
|
585
|
+
throw new InputError("Message text cannot be empty.");
|
|
586
|
+
}
|
|
587
587
|
const noWebpage = params?.linkPreview?.disable ? true : undefined;
|
|
588
588
|
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
589
589
|
let media = undefined;
|
|
@@ -630,16 +630,10 @@ export class MessageManager {
|
|
|
630
630
|
return (await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result))[0];
|
|
631
631
|
}
|
|
632
632
|
async editInlineMessageText(inlineMessageId, text, params) {
|
|
633
|
-
__classPrivateFieldGet(this, _MessageManager_instances, "m",
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
638
|
-
let media = undefined;
|
|
639
|
-
if (!noWebpage && params?.linkPreview?.url) {
|
|
640
|
-
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
641
|
-
}
|
|
642
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editInlineBotMessage", id, entities, message, media, no_webpage: noWebpage, invert_media: invertMedia, reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
633
|
+
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_editInlineMessageTextInner).call(this, inlineMessageId, text, params, false);
|
|
634
|
+
}
|
|
635
|
+
async editInlineMessageCaption(inlineMessageId, params) {
|
|
636
|
+
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_editInlineMessageTextInner).call(this, inlineMessageId, params?.caption ?? "", params);
|
|
643
637
|
}
|
|
644
638
|
async editMessageMedia(chatId, messageId, media, params) {
|
|
645
639
|
__classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
|
|
@@ -717,9 +711,6 @@ export class MessageManager {
|
|
|
717
711
|
async unpinMessages(chatId) {
|
|
718
712
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.unpinAllMessages", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId) });
|
|
719
713
|
}
|
|
720
|
-
async setAvailableReactions(chatId, availableReactions) {
|
|
721
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.setChatAvailableReactions", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), available_reactions: availableReactions == "none" ? { _: "chatReactionsNone" } : availableReactions == "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => reactionToTlObject(v)) }) : unreachable() });
|
|
722
|
-
}
|
|
723
714
|
async setReactions(chatId, messageId, reactions, params) {
|
|
724
715
|
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
|
|
725
716
|
}
|
|
@@ -751,7 +742,7 @@ export class MessageManager {
|
|
|
751
742
|
}
|
|
752
743
|
}
|
|
753
744
|
}
|
|
754
|
-
|
|
745
|
+
canHandleUpdate(update) {
|
|
755
746
|
return isOneOf(messageManagerUpdates, update);
|
|
756
747
|
}
|
|
757
748
|
async handleUpdate(update) {
|
|
@@ -833,20 +824,6 @@ export class MessageManager {
|
|
|
833
824
|
const deletedMessages = update.messages.map((v) => ({ chatId, messageId: v }));
|
|
834
825
|
return { deletedMessages, businessConnectionId: update.connection_id };
|
|
835
826
|
}
|
|
836
|
-
if (is("updateChannelParticipant", update) || is("updateChatParticipant", update)) {
|
|
837
|
-
const chatMember = await constructChatMemberUpdated(update, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
838
|
-
const selfId = await __classPrivateFieldGet(this, _MessageManager_c, "f").getSelfId();
|
|
839
|
-
if (chatMember.oldChatMember.user.id == selfId) {
|
|
840
|
-
return { myChatMember: chatMember };
|
|
841
|
-
}
|
|
842
|
-
else {
|
|
843
|
-
return { chatMember };
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
if (is("updateBotChatInviteRequester", update)) {
|
|
847
|
-
const joinRequest = await constructJoinRequest(update, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
848
|
-
return { joinRequest };
|
|
849
|
-
}
|
|
850
827
|
return null;
|
|
851
828
|
}
|
|
852
829
|
async sendChatAction(chatId, action, params) {
|
|
@@ -891,122 +868,6 @@ export class MessageManager {
|
|
|
891
868
|
}
|
|
892
869
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.setTyping", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), action: action_, top_msg_id: params?.messageThreadId }, params?.businessConnectionId);
|
|
893
870
|
}
|
|
894
|
-
async deleteChatPhoto(chatId) {
|
|
895
|
-
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
896
|
-
if (!(canBeInputChannel(peer)) && !(is("inputPeerChat", peer))) {
|
|
897
|
-
unreachable();
|
|
898
|
-
}
|
|
899
|
-
if (canBeInputChannel(peer)) {
|
|
900
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editPhoto", channel: toInputChannel(peer), photo: { _: "inputChatPhotoEmpty" } });
|
|
901
|
-
}
|
|
902
|
-
else if (is("inputPeerChat", peer)) {
|
|
903
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
async setChatPhoto(chatId, photo, params) {
|
|
907
|
-
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
908
|
-
if (!(canBeInputChannel(peer)) && !(is("inputPeerChat", peer))) {
|
|
909
|
-
unreachable();
|
|
910
|
-
}
|
|
911
|
-
const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(photo, params);
|
|
912
|
-
const photo_ = { _: "inputChatUploadedPhoto", file };
|
|
913
|
-
if (canBeInputChannel(peer)) {
|
|
914
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editPhoto", channel: toInputChannel(peer), photo: photo_ });
|
|
915
|
-
}
|
|
916
|
-
else if (is("inputPeerChat", peer)) {
|
|
917
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
async banChatMember(chatId, memberId, params) {
|
|
921
|
-
const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
922
|
-
if (!(is("inputPeerChannel", chat)) && !(is("inputPeerChat", chat))) {
|
|
923
|
-
throw new InputError("Expected a channel, supergroup, or group ID.");
|
|
924
|
-
}
|
|
925
|
-
const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
926
|
-
if (is("inputPeerChannel", chat)) {
|
|
927
|
-
if (params?.deleteMessages) {
|
|
928
|
-
try {
|
|
929
|
-
await this.deleteChatMemberMessages(chatId, memberId);
|
|
930
|
-
}
|
|
931
|
-
catch {
|
|
932
|
-
//
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
936
|
-
_: "channels.editBanned",
|
|
937
|
-
channel: { ...chat, _: "inputChannel" },
|
|
938
|
-
participant: member,
|
|
939
|
-
banned_rights: ({
|
|
940
|
-
_: "chatBannedRights",
|
|
941
|
-
until_date: params?.untilDate ? toUnixTimestamp(params.untilDate) : 0,
|
|
942
|
-
view_messages: true,
|
|
943
|
-
send_messages: true,
|
|
944
|
-
send_media: true,
|
|
945
|
-
send_stickers: true,
|
|
946
|
-
send_gifs: true,
|
|
947
|
-
send_games: true,
|
|
948
|
-
send_inline: true,
|
|
949
|
-
embed_links: true,
|
|
950
|
-
}),
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
else if (is("inputPeerChat", chat)) {
|
|
954
|
-
if (!canBeInputUser(member)) {
|
|
955
|
-
throw new InputError(`Invalid user ID: ${memberId}`);
|
|
956
|
-
}
|
|
957
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: toInputUser(member), revoke_history: params?.deleteMessages ? true : undefined });
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
async unbanChatMember(chatId, memberId) {
|
|
961
|
-
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
962
|
-
const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
963
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: ({ _: "chatBannedRights", until_date: 0 }) });
|
|
964
|
-
}
|
|
965
|
-
async setChatMemberRights(chatId, memberId, params) {
|
|
966
|
-
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
967
|
-
const member = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
|
|
968
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: chatMemberRightsToTlObject(params?.rights, params?.untilDate) });
|
|
969
|
-
}
|
|
970
|
-
async enableJoinRequests(chatId) {
|
|
971
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("enableJoinRequests");
|
|
972
|
-
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_toggleJoinRequests).call(this, chatId, true);
|
|
973
|
-
}
|
|
974
|
-
async disableJoinRequests(chatId) {
|
|
975
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("disableJoinRequests");
|
|
976
|
-
await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_toggleJoinRequests).call(this, chatId, false);
|
|
977
|
-
}
|
|
978
|
-
async approveJoinRequest(chatId, userId) {
|
|
979
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
980
|
-
_: "messages.hideChatJoinRequest",
|
|
981
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
982
|
-
user_id: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId),
|
|
983
|
-
approved: true,
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
async declineJoinRequest(chatId, userId) {
|
|
987
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
988
|
-
_: "messages.hideChatJoinRequest",
|
|
989
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
990
|
-
user_id: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId),
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
async approveJoinRequests(chatId, params) {
|
|
994
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("approveJoinRequests");
|
|
995
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
996
|
-
_: "messages.hideAllChatJoinRequests",
|
|
997
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
998
|
-
approved: true,
|
|
999
|
-
link: params?.inviteLink,
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
async declineJoinRequests(chatId, params) {
|
|
1003
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("declineJoinRequests");
|
|
1004
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
|
|
1005
|
-
_: "messages.hideAllChatJoinRequests",
|
|
1006
|
-
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
1007
|
-
link: params?.inviteLink,
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
871
|
async searchMessages(chatId, query, params) {
|
|
1011
872
|
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("searchMessages");
|
|
1012
873
|
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 });
|
|
@@ -1020,54 +881,6 @@ export class MessageManager {
|
|
|
1020
881
|
}
|
|
1021
882
|
return messages;
|
|
1022
883
|
}
|
|
1023
|
-
async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
|
|
1024
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("setBoostsRequiredToCircumventRestrictions");
|
|
1025
|
-
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
1026
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
|
|
1027
|
-
}
|
|
1028
|
-
async createInviteLink(chatId, params) {
|
|
1029
|
-
if (params?.requireApproval && params?.limit) {
|
|
1030
|
-
throw new InputError("requireApproval cannot be true while limit is specified.");
|
|
1031
|
-
}
|
|
1032
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.exportChatInvite", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt ? toUnixTimestamp(params.expireAt) : undefined, request_needed: params?.requireApproval ? true : undefined, usage_limit: params?.limit });
|
|
1033
|
-
return await constructInviteLink(as("chatInviteExported", result), __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
1034
|
-
}
|
|
1035
|
-
async getCreatedInviteLinks(chatId, params) {
|
|
1036
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("getCreatedInviteLinks");
|
|
1037
|
-
const { invites } = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.getExportedChatInvites", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), revoked: params?.revoked ? true : undefined, admin_id: params?.by ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(params.by) : { _: "inputUserEmpty" }, limit: params?.limit ?? 100, offset_date: params?.afterDate ? toUnixTimestamp(params.afterDate) : undefined, offset_link: params?.afterInviteLink });
|
|
1038
|
-
return await Promise.all(invites.map((v) => as("chatInviteExported", v)).map((v) => constructInviteLink(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)));
|
|
1039
|
-
}
|
|
1040
|
-
async joinChat(chatId) {
|
|
1041
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("joinChat");
|
|
1042
|
-
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1043
|
-
if (canBeInputUser(peer)) {
|
|
1044
|
-
throw new InputError("Cannot join private chats.");
|
|
1045
|
-
}
|
|
1046
|
-
else if (canBeInputChannel(peer)) {
|
|
1047
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.joinChannel", channel: toInputChannel(peer) });
|
|
1048
|
-
}
|
|
1049
|
-
else if (is("inputPeerChat", peer)) {
|
|
1050
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
|
|
1051
|
-
}
|
|
1052
|
-
else {
|
|
1053
|
-
unreachable();
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
async leaveChat(chatId) {
|
|
1057
|
-
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1058
|
-
if (canBeInputUser(peer)) {
|
|
1059
|
-
throw new InputError("Cannot leave private chats.");
|
|
1060
|
-
}
|
|
1061
|
-
else if (canBeInputChannel(peer)) {
|
|
1062
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.leaveChannel", channel: toInputChannel(peer) });
|
|
1063
|
-
}
|
|
1064
|
-
else if (is("inputPeerChat", peer)) {
|
|
1065
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
|
|
1066
|
-
}
|
|
1067
|
-
else {
|
|
1068
|
-
unreachable();
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
884
|
async blockUser(userId) {
|
|
1072
885
|
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("blockUser");
|
|
1073
886
|
const id = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId);
|
|
@@ -1190,42 +1003,6 @@ export class MessageManager {
|
|
|
1190
1003
|
}, params);
|
|
1191
1004
|
return assertMessageType(message, "invoice");
|
|
1192
1005
|
}
|
|
1193
|
-
async addChatMember(chatId, userId, params) {
|
|
1194
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("addChatMember");
|
|
1195
|
-
const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1196
|
-
if (isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
|
|
1197
|
-
throw new InputError("Cannot add members to private chats");
|
|
1198
|
-
}
|
|
1199
|
-
const user = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId);
|
|
1200
|
-
if (is("inputPeerChat", chat)) {
|
|
1201
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.addChatUser", chat_id: chat.chat_id, user_id: user, fwd_limit: params?.historyLimit ?? 0 });
|
|
1202
|
-
return result.missing_invitees.map(constructFailedInvitation);
|
|
1203
|
-
}
|
|
1204
|
-
else if (is("inputPeerChannel", chat)) {
|
|
1205
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.inviteToChannel", channel: { ...chat, _: "inputChannel" }, users: [user] });
|
|
1206
|
-
return result.missing_invitees.map(constructFailedInvitation);
|
|
1207
|
-
}
|
|
1208
|
-
unreachable();
|
|
1209
|
-
}
|
|
1210
|
-
async addChatMembers(chatId, userIds) {
|
|
1211
|
-
__classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("addChatMembers");
|
|
1212
|
-
const chat = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
1213
|
-
if (isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
|
|
1214
|
-
throw new InputError("Cannot add members to private chats");
|
|
1215
|
-
}
|
|
1216
|
-
const users = new Array();
|
|
1217
|
-
for (const userId of userIds) {
|
|
1218
|
-
users.push(await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(userId));
|
|
1219
|
-
}
|
|
1220
|
-
if (is("inputPeerChat", chat)) {
|
|
1221
|
-
throw new InputError("addChatMembers cannot be used with basic groups");
|
|
1222
|
-
}
|
|
1223
|
-
else if (canBeInputChannel(chat)) {
|
|
1224
|
-
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.inviteToChannel", channel: toInputChannel(chat), users });
|
|
1225
|
-
return result.missing_invitees.map(constructFailedInvitation);
|
|
1226
|
-
}
|
|
1227
|
-
unreachable();
|
|
1228
|
-
}
|
|
1229
1006
|
async sendMediaGroup(chatId, media, params) {
|
|
1230
1007
|
__classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
|
|
1231
1008
|
{
|
|
@@ -1452,6 +1229,20 @@ _a = MessageManager, _MessageManager_c = new WeakMap(), _MessageManager_Lresolve
|
|
|
1452
1229
|
allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
|
|
1453
1230
|
}, params?.businessConnectionId);
|
|
1454
1231
|
return (await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result, params?.businessConnectionId))[0];
|
|
1232
|
+
}, _MessageManager_editInlineMessageTextInner = async function _MessageManager_editInlineMessageTextInner(inlineMessageId, text, params, allowEmpty = true) {
|
|
1233
|
+
__classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
|
|
1234
|
+
const [message, entities] = await this.parseText(text, params);
|
|
1235
|
+
if (!allowEmpty && !message) {
|
|
1236
|
+
throw new InputError("Message text cannot be empty.");
|
|
1237
|
+
}
|
|
1238
|
+
const id = deserializeInlineMessageId(inlineMessageId);
|
|
1239
|
+
const noWebpage = params?.linkPreview?.disable ? true : undefined;
|
|
1240
|
+
const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
|
|
1241
|
+
let media = undefined;
|
|
1242
|
+
if (!noWebpage && params?.linkPreview?.url) {
|
|
1243
|
+
media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
|
|
1244
|
+
}
|
|
1245
|
+
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.editInlineBotMessage", id, entities, message, media, no_webpage: noWebpage, invert_media: invertMedia, reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params) });
|
|
1455
1246
|
}, _MessageManager_resolveInputMediaInner = async function _MessageManager_resolveInputMediaInner(document, media, fileType, otherAttribs) {
|
|
1456
1247
|
let media_ = null;
|
|
1457
1248
|
const spoiler = "hasSpoiler" in media && media.hasSpoiler ? true : undefined;
|
|
@@ -1534,8 +1325,5 @@ _a = MessageManager, _MessageManager_c = new WeakMap(), _MessageManager_Lresolve
|
|
|
1534
1325
|
}
|
|
1535
1326
|
}, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
|
|
1536
1327
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.sendReaction", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), msg_id: checkMessageId(messageId), reaction: reactions.map((v) => reactionToTlObject(v)), big: params?.big ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
|
|
1537
|
-
}, _MessageManager_toggleJoinRequests = async function _MessageManager_toggleJoinRequests(chatId, enabled) {
|
|
1538
|
-
const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
|
|
1539
|
-
await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.toggleJoinRequest", channel, enabled });
|
|
1540
1328
|
};
|
|
1541
1329
|
_MessageManager_CAPTIONABLE_MESSAGE_TYPES = { value: ["photo", "document", "video", "animation", "voice", "audio", "video"] };
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { ID, Update, VideoChatActive, VideoChatScheduled } from "../3_types.js";
|
|
22
22
|
import { DownloadLiveStreamChunkParams, JoinVideoChatParams, StartVideoChatParams } from "./0_params.js";
|
|
23
|
+
import { UpdateProcessor } from "./0_update_processor.js";
|
|
23
24
|
import { C as C_ } from "./1_types.js";
|
|
24
25
|
import { FileManager } from "./2_file_manager.js";
|
|
25
26
|
interface C extends C_ {
|
|
@@ -27,7 +28,7 @@ interface C extends C_ {
|
|
|
27
28
|
}
|
|
28
29
|
declare const videoChatManagerUpdates: readonly ["updateGroupCall"];
|
|
29
30
|
type VideoChatManagerUpdate = Api.Types[(typeof videoChatManagerUpdates)[number]];
|
|
30
|
-
export declare class VideoChatManager {
|
|
31
|
+
export declare class VideoChatManager implements UpdateProcessor<VideoChatManagerUpdate> {
|
|
31
32
|
#private;
|
|
32
33
|
constructor(c: C);
|
|
33
34
|
startVideoChat(chatId: ID, params?: StartVideoChatParams): Promise<VideoChatActive>;
|
|
@@ -36,7 +37,7 @@ export declare class VideoChatManager {
|
|
|
36
37
|
leaveVideoChat(id: string): Promise<void>;
|
|
37
38
|
joinLiveStream(id: string): Promise<void>;
|
|
38
39
|
getVideoChat(id: string): Promise<import("../3_types.js").VideoChat>;
|
|
39
|
-
|
|
40
|
+
canHandleUpdate(update: Api.Update): update is VideoChatManagerUpdate;
|
|
40
41
|
handleUpdate(update: VideoChatManagerUpdate): Promise<Update | null>;
|
|
41
42
|
getLiveStreamChannels(id: string): Promise<import("../3_types.js").LiveStreamChannel[]>;
|
|
42
43
|
downloadLiveStreamChunk(id: string, channel: number, scale: number, timestamp: number, params?: DownloadLiveStreamChunkParams): AsyncGenerator<Uint8Array, void, unknown>;
|
|
@@ -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,EAAmB,MAAM,YAAY,CAAC;AAClD,OAAO,EAAkD,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;
|
|
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,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,CAAC,IAAI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at(await __classPrivateFieldGet(this, _VideoChatManager_instances, "m", _VideoChatManager_getCall).call(this, id));
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
canHandleUpdate(update) {
|
|
97
97
|
return isOneOf(videoChatManagerUpdates, update);
|
|
98
98
|
}
|
|
99
99
|
async handleUpdate(update) {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { CallbackQueryQuestion, ID, Update } from "../3_types.js";
|
|
22
22
|
import { AnswerCallbackQueryParams } from "./0_params.js";
|
|
23
|
+
import { UpdateProcessor } from "./0_update_processor.js";
|
|
23
24
|
import { C as C_ } from "./1_types.js";
|
|
24
25
|
import { MessageManager } from "./3_message_manager.js";
|
|
25
26
|
type C = C_ & {
|
|
@@ -27,12 +28,12 @@ type C = C_ & {
|
|
|
27
28
|
};
|
|
28
29
|
declare const callbackQueryManagerUpdates: readonly ["updateBotCallbackQuery", "updateInlineBotCallbackQuery"];
|
|
29
30
|
type CallbackQueryManagerUpdate = Api.Types[(typeof callbackQueryManagerUpdates)[number]];
|
|
30
|
-
export declare class CallbackQueryManager {
|
|
31
|
+
export declare class CallbackQueryManager implements UpdateProcessor<CallbackQueryManagerUpdate> {
|
|
31
32
|
#private;
|
|
32
33
|
constructor(c: C);
|
|
33
34
|
answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
|
|
34
35
|
sendCallbackQuery(chatId: ID, messageId: number, question: CallbackQueryQuestion): Promise<import("../3_types.js").CallbackQueryAnswer>;
|
|
35
|
-
|
|
36
|
+
canHandleUpdate(update: Api.Update): update is CallbackQueryManagerUpdate;
|
|
36
37
|
handleUpdate(update: CallbackQueryManagerUpdate): Promise<Update>;
|
|
37
38
|
}
|
|
38
39
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_callback_query_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_callback_query_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;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AAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC;CAGxE"}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { ChatListItem, ChatMember, ChatP, type ChatPChannel, type ChatPSupergroup, ID } from "../3_types.js";
|
|
22
22
|
import { type CreateChannelParams, type CreateGroupParams, type CreateSupergroupParams, GetChatMembersParams, GetCommonChatsParams } from "./0_params.js";
|
|
23
|
+
import { UpdateProcessor } from "./0_update_processor.js";
|
|
23
24
|
import { C as C_ } from "./1_types.js";
|
|
24
25
|
import { FileManager } from "./2_file_manager.js";
|
|
25
26
|
import { MessageManager } from "./3_message_manager.js";
|
|
@@ -29,13 +30,13 @@ type C = C_ & {
|
|
|
29
30
|
};
|
|
30
31
|
declare const chatListManagerUpdates: readonly ["updateNewMessage", "updateNewChannelMessage", "updatePinnedDialogs", "updateFolderPeers", "updateChannel", "updateChat", "updateUser", "updateUserName"];
|
|
31
32
|
type ChatListManagerUpdate = Api.Types[(typeof chatListManagerUpdates)[number]];
|
|
32
|
-
export declare class ChatListManager {
|
|
33
|
+
export declare class ChatListManager implements UpdateProcessor<ChatListManagerUpdate> {
|
|
33
34
|
#private;
|
|
34
35
|
constructor(c: C);
|
|
35
36
|
reassignChatLastMessage(chatId: number, add?: boolean, sendUpdate?: boolean): Promise<() => void>;
|
|
36
37
|
getChats(from?: "archived" | "main", after?: ChatListItem, limit?: number): Promise<ChatListItem[]>;
|
|
37
|
-
|
|
38
|
-
handleUpdate(update: ChatListManagerUpdate): Promise<
|
|
38
|
+
canHandleUpdate(update: Api.Update): update is ChatListManagerUpdate;
|
|
39
|
+
handleUpdate(update: ChatListManagerUpdate): Promise<null>;
|
|
39
40
|
getChat(chatId: ID): Promise<import("../3_types.js").Chat>;
|
|
40
41
|
getChatAdministrators(chatId: ID): Promise<ChatMember[]>;
|
|
41
42
|
getChatMember(chatId: ID, userId: ID): Promise<ChatMember>;
|
|
@@ -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,EAAiD,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAmJ,EAAE,EAAE,MAAM,eAAe,CAAC;AAC9P,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;
|
|
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,EAAiD,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAmJ,EAAE,EAAE,MAAM,eAAe,CAAC;AAC9P,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1J,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,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;A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oB;CAuB/D"}
|
|
@@ -150,7 +150,7 @@ export class ChatListManager {
|
|
|
150
150
|
chats = chats.slice(0, limit);
|
|
151
151
|
return chats;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
canHandleUpdate(update) {
|
|
154
154
|
return isOneOf(chatListManagerUpdates, update);
|
|
155
155
|
}
|
|
156
156
|
async handleUpdate(update) {
|
|
@@ -178,6 +178,7 @@ export class ChatListManager {
|
|
|
178
178
|
else {
|
|
179
179
|
unreachable();
|
|
180
180
|
}
|
|
181
|
+
return null;
|
|
181
182
|
}
|
|
182
183
|
async getChat(chatId) {
|
|
183
184
|
const fullChat = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getFullChat).call(this, chatId);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { Api } from "../2_tl.js";
|
|
21
|
+
import { FileSource, ID, Reaction, Update } from "../3_types.js";
|
|
22
|
+
import { AddChatMemberParams, ApproveJoinRequestsParams, BanChatMemberParams, CreateInviteLinkParams, DeclineJoinRequestsParams, GetCreatedInviteLinksParams, SetChatMemberRightsParams, SetChatPhotoParams } from "./0_params.js";
|
|
23
|
+
import { UpdateProcessor } from "./0_update_processor.js";
|
|
24
|
+
import { C as C_ } from "./1_types.js";
|
|
25
|
+
import { FileManager } from "./2_file_manager.js";
|
|
26
|
+
import { MessageManager } from "./3_message_manager.js";
|
|
27
|
+
interface C extends C_ {
|
|
28
|
+
fileManager: FileManager;
|
|
29
|
+
messageManager: MessageManager;
|
|
30
|
+
}
|
|
31
|
+
declare const chatManagerUpdates: readonly ["updateChannelParticipant", "updateChatParticipant", "updateBotChatInviteRequester"];
|
|
32
|
+
type ChatManagerUpdate = Api.Types[(typeof chatManagerUpdates)[number]];
|
|
33
|
+
export declare class ChatManager implements UpdateProcessor<ChatManagerUpdate> {
|
|
34
|
+
#private;
|
|
35
|
+
constructor(c: C);
|
|
36
|
+
canHandleUpdate(update: Api.Update): update is ChatManagerUpdate;
|
|
37
|
+
handleUpdate(update: ChatManagerUpdate): Promise<Update | null>;
|
|
38
|
+
approveJoinRequest(chatId: ID, userId: ID): Promise<void>;
|
|
39
|
+
declineJoinRequest(chatId: ID, userId: ID): Promise<void>;
|
|
40
|
+
approveJoinRequests(chatId: ID, params?: ApproveJoinRequestsParams): Promise<void>;
|
|
41
|
+
declineJoinRequests(chatId: ID, params?: DeclineJoinRequestsParams): Promise<void>;
|
|
42
|
+
createInviteLink(chatId: ID, params?: CreateInviteLinkParams): Promise<import("../3_types.js").InviteLink>;
|
|
43
|
+
getCreatedInviteLinks(chatId: ID, params?: GetCreatedInviteLinksParams): Promise<import("../3_types.js").InviteLink[]>;
|
|
44
|
+
joinChat(chatId: ID): Promise<void>;
|
|
45
|
+
leaveChat(chatId: ID): Promise<void>;
|
|
46
|
+
banChatMember(chatId: ID, memberId: ID, params?: BanChatMemberParams): Promise<void>;
|
|
47
|
+
unbanChatMember(chatId: ID, memberId: ID): Promise<void>;
|
|
48
|
+
setChatMemberRights(chatId: ID, memberId: ID, params?: SetChatMemberRightsParams): Promise<void>;
|
|
49
|
+
setAvailableReactions(chatId: ID, availableReactions: "none" | "all" | Reaction[]): Promise<void>;
|
|
50
|
+
setBoostsRequiredToCircumventRestrictions(chatId: ID, boosts: number): Promise<void>;
|
|
51
|
+
enableJoinRequests(chatId: ID): Promise<void>;
|
|
52
|
+
disableJoinRequests(chatId: ID): Promise<void>;
|
|
53
|
+
setChatStickerSet(chatId: ID, setName: string): Promise<void>;
|
|
54
|
+
deleteChatStickerSet(chatId: ID): Promise<void>;
|
|
55
|
+
deleteChatPhoto(chatId: number): Promise<void>;
|
|
56
|
+
setChatPhoto(chatId: number, photo: FileSource, params?: SetChatPhotoParams): Promise<void>;
|
|
57
|
+
addChatMember(chatId: ID, userId: ID, params?: AddChatMemberParams): Promise<import("../3_types.js").FailedInvitation[]>;
|
|
58
|
+
addChatMembers(chatId: ID, userIds: ID[]): Promise<import("../3_types.js").FailedInvitation[]>;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=4_chat_manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"4_chat_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_chat_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAmB,MAAM,YAAY,CAAC;AAElD,OAAO,EAA8B,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAsB,MAAM,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAA8E,mBAAmB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC/S,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,E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