@mtkruto/node 0.74.0 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/3_types.d.ts +1 -1
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +1 -1
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +30 -6
- package/esm/client/4_chat_manager.js +1 -1
- package/esm/client/5_client.d.ts +3 -3
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +48 -40
- package/esm/types/{3_chat_member.d.ts → 2_chat_member.d.ts} +4 -5
- package/esm/types/2_chat_member.d.ts.map +1 -0
- package/esm/types/{3_chat_member.js → 2_chat_member.js} +10 -12
- package/esm/types/4_chat_member_updated.d.ts +1 -1
- package/esm/types/4_chat_member_updated.d.ts.map +1 -1
- package/esm/types/4_chat_member_updated.js +7 -7
- package/package.json +1 -1
- package/script/3_types.d.ts +1 -1
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +1 -1
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +30 -6
- package/script/client/4_chat_manager.js +1 -1
- package/script/client/5_client.d.ts +3 -3
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +48 -40
- package/script/types/{3_chat_member.d.ts → 2_chat_member.d.ts} +4 -5
- package/script/types/2_chat_member.d.ts.map +1 -0
- package/script/types/{3_chat_member.js → 2_chat_member.js} +10 -12
- package/script/types/4_chat_member_updated.d.ts +1 -1
- package/script/types/4_chat_member_updated.d.ts.map +1 -1
- package/script/types/4_chat_member_updated.js +7 -7
- package/esm/types/3_chat_member.d.ts.map +0 -1
- package/script/types/3_chat_member.d.ts.map +0 -1
|
@@ -333,6 +333,14 @@ class Client extends Composer {
|
|
|
333
333
|
(0, _0_deps_js_1.unreachable)();
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
|
+
const mustGetChatId = (ctx) => {
|
|
337
|
+
if (ctx.chat) {
|
|
338
|
+
return ctx.chat.id;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
(0, _0_deps_js_1.unreachable)();
|
|
342
|
+
}
|
|
343
|
+
};
|
|
336
344
|
const mustGetUserId = (ctx) => {
|
|
337
345
|
if (ctx.msg?.from) {
|
|
338
346
|
return ctx.msg.from.id;
|
|
@@ -513,7 +521,7 @@ class Client extends Composer {
|
|
|
513
521
|
return this.client.setChatMemberRights(chatId, senderId, params);
|
|
514
522
|
},
|
|
515
523
|
getChatAdministrators() {
|
|
516
|
-
const
|
|
524
|
+
const chatId = mustGetChatId(this);
|
|
517
525
|
return this.client.getChatAdministrators(chatId);
|
|
518
526
|
},
|
|
519
527
|
react(reactions, params) {
|
|
@@ -533,7 +541,7 @@ class Client extends Composer {
|
|
|
533
541
|
return this.client.answerInlineQuery(update.inlineQuery.id, results, params);
|
|
534
542
|
},
|
|
535
543
|
sendChatAction(chatAction, params) {
|
|
536
|
-
const
|
|
544
|
+
const chatId = mustGetChatId(this);
|
|
537
545
|
return this.client.sendChatAction(chatId, chatAction, params);
|
|
538
546
|
},
|
|
539
547
|
editInlineMessageText(text, params) {
|
|
@@ -557,75 +565,75 @@ class Client extends Composer {
|
|
|
557
565
|
return this.client.editInlineMessageReplyMarkup(inlineMessageId, params);
|
|
558
566
|
},
|
|
559
567
|
editMessageText(messageId, text, params) {
|
|
560
|
-
const
|
|
568
|
+
const chatId = mustGetChatId(this);
|
|
561
569
|
return this.client.editMessageText(chatId, messageId, text, params);
|
|
562
570
|
},
|
|
563
571
|
editMessageCaption(messageId, params) {
|
|
564
|
-
const
|
|
572
|
+
const chatId = mustGetChatId(this);
|
|
565
573
|
return this.client.editMessageCaption(chatId, messageId, params);
|
|
566
574
|
},
|
|
567
575
|
editMessageMedia(messageId, media, params) {
|
|
568
|
-
const
|
|
576
|
+
const chatId = mustGetChatId(this);
|
|
569
577
|
return this.client.editMessageMedia(chatId, messageId, media, params);
|
|
570
578
|
},
|
|
571
579
|
editMessageLiveLocation(messageId, latitude, longitude, params) {
|
|
572
|
-
const
|
|
580
|
+
const chatId = mustGetChatId(this);
|
|
573
581
|
return this.client.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
|
|
574
582
|
},
|
|
575
583
|
editMessageReplyMarkup(messageId, params) {
|
|
576
|
-
const
|
|
584
|
+
const chatId = mustGetChatId(this);
|
|
577
585
|
return this.client.editMessageReplyMarkup(chatId, messageId, params);
|
|
578
586
|
},
|
|
579
587
|
getMessage(messageId) {
|
|
580
|
-
const
|
|
588
|
+
const chatId = mustGetChatId(this);
|
|
581
589
|
return this.client.getMessage(chatId, messageId);
|
|
582
590
|
},
|
|
583
591
|
getMessages(messageIds) {
|
|
584
|
-
const
|
|
592
|
+
const chatId = mustGetChatId(this);
|
|
585
593
|
return this.client.getMessages(chatId, messageIds);
|
|
586
594
|
},
|
|
587
595
|
forwardMessage(to, messageId, params) {
|
|
588
|
-
const
|
|
596
|
+
const chatId = mustGetChatId(this);
|
|
589
597
|
return this.client.forwardMessage(chatId, to, messageId, params);
|
|
590
598
|
},
|
|
591
599
|
forwardMessages(to, messageIds, params) {
|
|
592
|
-
const
|
|
600
|
+
const chatId = mustGetChatId(this);
|
|
593
601
|
return this.client.forwardMessages(chatId, to, messageIds, params);
|
|
594
602
|
},
|
|
595
603
|
deleteMessage(messageId, params) {
|
|
596
|
-
const
|
|
604
|
+
const chatId = mustGetChatId(this);
|
|
597
605
|
return this.client.deleteMessage(chatId, messageId, params);
|
|
598
606
|
},
|
|
599
607
|
deleteMessages(messageIds, params) {
|
|
600
|
-
const
|
|
608
|
+
const chatId = mustGetChatId(this);
|
|
601
609
|
return this.client.deleteMessages(chatId, messageIds, params);
|
|
602
610
|
},
|
|
603
611
|
pinMessage(messageId, params) {
|
|
604
|
-
const
|
|
612
|
+
const chatId = mustGetChatId(this);
|
|
605
613
|
return this.client.pinMessage(chatId, messageId, params);
|
|
606
614
|
},
|
|
607
615
|
unpinMessage(messageId) {
|
|
608
|
-
const
|
|
616
|
+
const chatId = mustGetChatId(this);
|
|
609
617
|
return this.client.unpinMessage(chatId, messageId);
|
|
610
618
|
},
|
|
611
619
|
unpinMessages() {
|
|
612
|
-
const
|
|
620
|
+
const chatId = mustGetChatId(this);
|
|
613
621
|
return this.client.unpinMessages(chatId);
|
|
614
622
|
},
|
|
615
623
|
setAvailableReactions(availableReactions) {
|
|
616
|
-
const
|
|
624
|
+
const chatId = mustGetChatId(this);
|
|
617
625
|
return this.client.setAvailableReactions(chatId, availableReactions);
|
|
618
626
|
},
|
|
619
627
|
addReaction(messageId, reaction, params) {
|
|
620
|
-
const
|
|
628
|
+
const chatId = mustGetChatId(this);
|
|
621
629
|
return this.client.addReaction(chatId, messageId, reaction, params);
|
|
622
630
|
},
|
|
623
631
|
removeReaction(messageId, reaction) {
|
|
624
|
-
const
|
|
632
|
+
const chatId = mustGetChatId(this);
|
|
625
633
|
return this.client.removeReaction(chatId, messageId, reaction);
|
|
626
634
|
},
|
|
627
635
|
setReactions(messageId, reactions, params) {
|
|
628
|
-
const
|
|
636
|
+
const chatId = mustGetChatId(this);
|
|
629
637
|
return this.client.setReactions(chatId, messageId, reactions, params);
|
|
630
638
|
},
|
|
631
639
|
read() {
|
|
@@ -633,79 +641,79 @@ class Client extends Composer {
|
|
|
633
641
|
return this.client.readMessages(chatId, messageId);
|
|
634
642
|
},
|
|
635
643
|
setChatPhoto(photo, params) {
|
|
636
|
-
const
|
|
644
|
+
const chatId = mustGetChatId(this);
|
|
637
645
|
return this.client.setChatPhoto(chatId, photo, params);
|
|
638
646
|
},
|
|
639
647
|
deleteChatPhoto() {
|
|
640
|
-
const
|
|
648
|
+
const chatId = mustGetChatId(this);
|
|
641
649
|
return this.client.deleteChatPhoto(chatId);
|
|
642
650
|
},
|
|
643
651
|
banChatMember(memberId, params) {
|
|
644
|
-
const
|
|
652
|
+
const chatId = mustGetChatId(this);
|
|
645
653
|
return this.client.banChatMember(chatId, memberId, params);
|
|
646
654
|
},
|
|
647
655
|
unbanChatMember(memberId) {
|
|
648
|
-
const
|
|
656
|
+
const chatId = mustGetChatId(this);
|
|
649
657
|
return this.client.unbanChatMember(chatId, memberId);
|
|
650
658
|
},
|
|
651
659
|
kickChatMember(memberId) {
|
|
652
|
-
const
|
|
660
|
+
const chatId = mustGetChatId(this);
|
|
653
661
|
return this.client.kickChatMember(chatId, memberId);
|
|
654
662
|
},
|
|
655
663
|
setChatMemberRights(memberId, params) {
|
|
656
|
-
const
|
|
664
|
+
const chatId = mustGetChatId(this);
|
|
657
665
|
return this.client.setChatMemberRights(chatId, memberId, params);
|
|
658
666
|
},
|
|
659
667
|
promoteChatMember(userId, params) {
|
|
660
|
-
const
|
|
668
|
+
const chatId = mustGetChatId(this);
|
|
661
669
|
return this.client.promoteChatMember(chatId, userId, params);
|
|
662
670
|
},
|
|
663
671
|
deleteChatMemberMessages(userId) {
|
|
664
|
-
const
|
|
672
|
+
const chatId = mustGetChatId(this);
|
|
665
673
|
return this.client.deleteChatMemberMessages(chatId, userId);
|
|
666
674
|
},
|
|
667
675
|
searchMessages(params) {
|
|
668
|
-
const
|
|
676
|
+
const chatId = mustGetChatId(this);
|
|
669
677
|
params ??= {};
|
|
670
678
|
params.chatId = chatId;
|
|
671
679
|
return this.client.searchMessages(params);
|
|
672
680
|
},
|
|
673
681
|
setBoostsRequiredToCircumventRestrictions(boosts) {
|
|
674
|
-
const
|
|
682
|
+
const chatId = mustGetChatId(this);
|
|
675
683
|
return this.client.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
|
|
676
684
|
},
|
|
677
685
|
createInviteLink(params) {
|
|
678
|
-
const
|
|
686
|
+
const chatId = mustGetChatId(this);
|
|
679
687
|
return this.client.createInviteLink(chatId, params);
|
|
680
688
|
},
|
|
681
689
|
getCreatedInviteLinks(params) {
|
|
682
|
-
const
|
|
690
|
+
const chatId = mustGetChatId(this);
|
|
683
691
|
return this.client.getCreatedInviteLinks(chatId, params);
|
|
684
692
|
},
|
|
685
|
-
|
|
686
|
-
const
|
|
693
|
+
leaveChat() {
|
|
694
|
+
const chatId = mustGetChatId(this);
|
|
687
695
|
return this.client.leaveChat(chatId);
|
|
688
696
|
},
|
|
689
|
-
|
|
697
|
+
blockUser() {
|
|
690
698
|
return this.client.blockUser(mustGetUserId(this));
|
|
691
699
|
},
|
|
692
|
-
|
|
700
|
+
unblockUser() {
|
|
693
701
|
return this.client.unblockUser(mustGetUserId(this));
|
|
694
702
|
},
|
|
695
703
|
getChatMember(userId) {
|
|
696
|
-
const
|
|
704
|
+
const chatId = mustGetChatId(this);
|
|
697
705
|
return this.client.getChatMember(chatId, userId);
|
|
698
706
|
},
|
|
699
707
|
getChatMembers(params) {
|
|
700
|
-
const
|
|
708
|
+
const chatId = mustGetChatId(this);
|
|
701
709
|
return this.client.getChatMembers(chatId, params);
|
|
702
710
|
},
|
|
703
711
|
setChatStickerSet(setName) {
|
|
704
|
-
const
|
|
712
|
+
const chatId = mustGetChatId(this);
|
|
705
713
|
return this.client.setChatStickerSet(chatId, setName);
|
|
706
714
|
},
|
|
707
715
|
deleteChatStickerSet() {
|
|
708
|
-
const
|
|
716
|
+
const chatId = mustGetChatId(this);
|
|
709
717
|
return this.client.deleteChatStickerSet(chatId);
|
|
710
718
|
},
|
|
711
719
|
getBusinessConnection() {
|
|
@@ -20,14 +20,13 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import { type ChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
22
22
|
import { type ChatMemberRights } from "./0_chat_member_rights.js";
|
|
23
|
-
import type { PeerGetter } from "./1_chat_p.js";
|
|
24
|
-
import { type User } from "./2_user.js";
|
|
23
|
+
import type { ChatP, PeerGetter } from "./1_chat_p.js";
|
|
25
24
|
/** @unlisted */
|
|
26
25
|
export type ChatMemberStatus = "creator" | "administrator" | "member" | "restricted" | "left" | "banned";
|
|
27
26
|
/** @unlisted */
|
|
28
27
|
export interface _ChatMemberBase {
|
|
29
28
|
status: ChatMemberStatus;
|
|
30
|
-
|
|
29
|
+
member: ChatP;
|
|
31
30
|
}
|
|
32
31
|
/** @unlisted */
|
|
33
32
|
export interface ChatMemberCreator extends _ChatMemberBase {
|
|
@@ -64,7 +63,7 @@ export interface ChatMemberBanned extends _ChatMemberBase {
|
|
|
64
63
|
}
|
|
65
64
|
/** A chat member. */
|
|
66
65
|
export type ChatMember = ChatMemberCreator | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned;
|
|
67
|
-
export declare function constructChatMember(participant: Api.ChannelParticipant | Api.ChatParticipant | (Omit<Api.ChannelParticipant, "peer"> & {
|
|
66
|
+
export declare function constructChatMember(member: ChatP, participant: Api.ChannelParticipant | Api.ChatParticipant | (Omit<Api.ChannelParticipant, "peer"> & {
|
|
68
67
|
peer: ReturnType<typeof getPeer>;
|
|
69
68
|
}), getPeer: PeerGetter): ChatMember;
|
|
70
|
-
//# sourceMappingURL=
|
|
69
|
+
//# sourceMappingURL=2_chat_member.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"2_chat_member.d.ts","sourceRoot":"","sources":["../../src/types/2_chat_member.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,uBAAuB,EAAoC,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,2BAA2B,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD,gBAAgB;AAChB,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzG,gBAAgB;AAChB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MA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CAAE,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,UAAU,CAkF7N"}
|
|
@@ -25,22 +25,20 @@ const _1_utilities_js_1 = require("../1_utilities.js");
|
|
|
25
25
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
26
26
|
const _0_chat_administrator_rights_js_1 = require("./0_chat_administrator_rights.js");
|
|
27
27
|
const _0_chat_member_rights_js_1 = require("./0_chat_member_rights.js");
|
|
28
|
-
|
|
29
|
-
function constructChatMember(participant, getPeer) {
|
|
28
|
+
function constructChatMember(member, participant, getPeer) {
|
|
30
29
|
const peer = "user_id" in participant ? getPeer({ ...participant, _: "peerUser" }) : "peer" in participant ? Array.isArray(participant.peer) ? participant.peer : _2_tl_js_1.Api.is("peerUser", participant.peer) ? getPeer(participant.peer) : (0, _0_deps_js_1.unreachable)() : (0, _0_deps_js_1.unreachable)(); // TODO: support other peer types
|
|
31
30
|
if (peer === null || peer[0].type !== "private")
|
|
32
31
|
(0, _0_deps_js_1.unreachable)();
|
|
33
|
-
const user = (0, _2_user_js_1.constructUser2)(peer[0]);
|
|
34
32
|
if (_2_tl_js_1.Api.is("channelParticipant", participant) || _2_tl_js_1.Api.is("chatParticipant", participant)) {
|
|
35
33
|
return {
|
|
36
34
|
status: "member",
|
|
37
|
-
|
|
35
|
+
member,
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
38
|
else if (_2_tl_js_1.Api.is("channelParticipantCreator", participant)) {
|
|
41
39
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
42
40
|
status: "creator",
|
|
43
|
-
|
|
41
|
+
member,
|
|
44
42
|
isAnonymous: participant.admin_rights.anonymous ? true : false,
|
|
45
43
|
title: participant.rank,
|
|
46
44
|
});
|
|
@@ -48,7 +46,7 @@ function constructChatMember(participant, getPeer) {
|
|
|
48
46
|
else if (_2_tl_js_1.Api.is("channelParticipantAdmin", participant)) {
|
|
49
47
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
50
48
|
status: "administrator",
|
|
51
|
-
|
|
49
|
+
member,
|
|
52
50
|
rights: (0, _0_chat_administrator_rights_js_1.constructChatAdministratorRights)(participant.admin_rights),
|
|
53
51
|
title: participant.rank,
|
|
54
52
|
});
|
|
@@ -59,7 +57,7 @@ function constructChatMember(participant, getPeer) {
|
|
|
59
57
|
participant.peer;
|
|
60
58
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
61
59
|
status: "banned",
|
|
62
|
-
|
|
60
|
+
member,
|
|
63
61
|
until,
|
|
64
62
|
});
|
|
65
63
|
}
|
|
@@ -67,7 +65,7 @@ function constructChatMember(participant, getPeer) {
|
|
|
67
65
|
const rights = (0, _0_chat_member_rights_js_1.constructChatMemberRights)(participant.banned_rights);
|
|
68
66
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
69
67
|
status: "restricted",
|
|
70
|
-
|
|
68
|
+
member,
|
|
71
69
|
isMember,
|
|
72
70
|
rights,
|
|
73
71
|
until,
|
|
@@ -77,17 +75,17 @@ function constructChatMember(participant, getPeer) {
|
|
|
77
75
|
const until = participant.subscription_until_date ? participant.subscription_until_date : undefined;
|
|
78
76
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
79
77
|
status: "member",
|
|
80
|
-
|
|
78
|
+
member,
|
|
81
79
|
until,
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
82
|
else if (_2_tl_js_1.Api.is("channelParticipantLeft", participant)) {
|
|
85
|
-
return { status: "left",
|
|
83
|
+
return { status: "left", member };
|
|
86
84
|
}
|
|
87
85
|
else if (_2_tl_js_1.Api.is("chatParticipantAdmin", participant)) {
|
|
88
86
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
89
87
|
status: "administrator",
|
|
90
|
-
|
|
88
|
+
member,
|
|
91
89
|
rights: {
|
|
92
90
|
isAnonymous: false,
|
|
93
91
|
canManageChat: true,
|
|
@@ -111,7 +109,7 @@ function constructChatMember(participant, getPeer) {
|
|
|
111
109
|
else if (_2_tl_js_1.Api.is("chatParticipantCreator", participant)) {
|
|
112
110
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
113
111
|
status: "creator",
|
|
114
|
-
|
|
112
|
+
member,
|
|
115
113
|
isAnonymous: false,
|
|
116
114
|
});
|
|
117
115
|
}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import type { ChatP, PeerGetter } from "./1_chat_p.js";
|
|
22
|
+
import { type ChatMember } from "./2_chat_member.js";
|
|
22
23
|
import { type User } from "./2_user.js";
|
|
23
|
-
import { type ChatMember } from "./3_chat_member.js";
|
|
24
24
|
import { type InviteLink } from "./3_invite_link.js";
|
|
25
25
|
/** Changes made to a chat member. */
|
|
26
26
|
export interface ChatMemberUpdated {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_chat_member_updated.d.ts","sourceRoot":"","sources":["../../src/types/4_chat_member_updated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"4_chat_member_updated.d.ts","sourceRoot":"","sources":["../../src/types/4_chat_member_updated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,IAAI,EAAE,KAAK,CAAC;IACZ,mCAAmC;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,aAAa,EAAE,UAAU,CAAC;IAC1B,yCAAyC;IACzC,aAAa,EAAE,UAAU,CAAC;IAC1B,oCAAoC;IACpC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,GAAG,GAAG,CAAC,qBAAqB,EAAE,OAAO,EAAE,UAAU,GAAG,iBAAiB,CA0BnJ"}
|
|
@@ -23,24 +23,24 @@ exports.constructChatMemberUpdated = constructChatMemberUpdated;
|
|
|
23
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
24
24
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
25
25
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
26
|
+
const _2_chat_member_js_1 = require("./2_chat_member.js");
|
|
26
27
|
const _2_user_js_1 = require("./2_user.js");
|
|
27
|
-
const _3_chat_member_js_1 = require("./3_chat_member.js");
|
|
28
28
|
const _3_invite_link_js_1 = require("./3_invite_link.js");
|
|
29
29
|
function constructChatMemberUpdated(update, getPeer) {
|
|
30
30
|
if (!update.prev_participant && !update.new_participant) {
|
|
31
31
|
(0, _0_deps_js_1.unreachable)();
|
|
32
32
|
}
|
|
33
33
|
const peer = getPeer("channel_id" in update ? { channel_id: update.channel_id, _: "peerChannel" } : { chat_id: update.chat_id, _: "peerChat" });
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const actorPeer = getPeer({ _: "peerUser", user_id: update.actor_id });
|
|
35
|
+
const memberPeer = getPeer(update.new_participant && "peer" in update.new_participant ? update.new_participant.peer : update.prev_participant && "peer" in update.prev_participant ? update.prev_participant.peer : { _: "peerUser", user_id: update.user_id });
|
|
36
|
+
if (!peer || !memberPeer || !actorPeer) {
|
|
36
37
|
(0, _0_deps_js_1.unreachable)();
|
|
37
38
|
}
|
|
38
39
|
const chat = peer[0];
|
|
39
|
-
const from = (0, _2_user_js_1.constructUser2)(
|
|
40
|
+
const from = (0, _2_user_js_1.constructUser2)(actorPeer[0]);
|
|
40
41
|
const date = update.date;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const newChatMember = (0, _3_chat_member_js_1.constructChatMember)(update.new_participant ?? ({ _: "channelParticipantLeft", peer: userPeer }), getPeer);
|
|
42
|
+
const oldChatMember = (0, _2_chat_member_js_1.constructChatMember)(memberPeer[0], update.prev_participant ?? ({ _: "channelParticipantLeft", peer: memberPeer }), getPeer);
|
|
43
|
+
const newChatMember = (0, _2_chat_member_js_1.constructChatMember)(memberPeer[0], update.new_participant ?? ({ _: "channelParticipantLeft", peer: memberPeer }), getPeer);
|
|
44
44
|
const viaSharedFolder = "via_chatlist" in update ? update.via_chatlist ? true : update.invite ? false : undefined : undefined;
|
|
45
45
|
const inviteLink = (update.invite && _2_tl_js_1.Api.is("chatInviteExported", update.invite)) ? (0, _3_invite_link_js_1.constructInviteLink)(update.invite, getPeer) : undefined;
|
|
46
46
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3_chat_member.d.ts","sourceRoot":"","sources":["../../src/types/3_chat_member.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,uBAAuB,EAAoC,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,2BAA2B,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAExD,gBAAgB;AAChB,MAAM,MAAM,gBAAgB,GAAG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