@rexxhayanasi/elaina-baileys 1.1.0-rc.4 → 1.1.0-rc.5
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/README.MD +55 -14
- package/WAProto/WAProto.proto +1013 -169
- package/lib/Socket/Rhandler.js +158 -240
- package/lib/Socket/chats.js +52 -2
- package/lib/Socket/messages-send.js +12 -10
- package/package.json +1 -1
package/lib/Socket/chats.js
CHANGED
|
@@ -24,7 +24,14 @@ const SyncState = {
|
|
|
24
24
|
Online: 'online'
|
|
25
25
|
};
|
|
26
26
|
const makeChatsSocket = (config) => {
|
|
27
|
-
const
|
|
27
|
+
const {
|
|
28
|
+
logger,
|
|
29
|
+
markOnlineOnConnect,
|
|
30
|
+
fireInitQueries,
|
|
31
|
+
appStateMacVerification,
|
|
32
|
+
shouldIgnoreJid,
|
|
33
|
+
shouldSyncHistoryMessage,
|
|
34
|
+
relayMessage, } = config;
|
|
28
35
|
const sock = (0, usync_1.makeUSyncSocket)(config);
|
|
29
36
|
const { ev, ws, authState, generateMessageTag, sendNode, query, signalRepository, onUnexpectedError, } = sock;
|
|
30
37
|
let privacySettings;
|
|
@@ -857,6 +864,47 @@ const getBusinessProfile = async (jid) => {
|
|
|
857
864
|
const removeContact = (jid) => {
|
|
858
865
|
return chatModify({ contact: null }, jid);
|
|
859
866
|
};
|
|
867
|
+
|
|
868
|
+
const addLabelMember = async (jid, label, timestamp = Date.now()) => {
|
|
869
|
+
try {
|
|
870
|
+
return await relayMessage(
|
|
871
|
+
jid,
|
|
872
|
+
{
|
|
873
|
+
protocolMessage: {
|
|
874
|
+
type: 30,
|
|
875
|
+
memberLabel: {
|
|
876
|
+
label,
|
|
877
|
+
labelTimestamp: timestamp
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
{}
|
|
882
|
+
)
|
|
883
|
+
} catch (e) {
|
|
884
|
+
logger.error('Failed addLabelMember: ' + e)
|
|
885
|
+
throw e
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const removeLabelMember = async (jid) => {
|
|
890
|
+
try {
|
|
891
|
+
return await relayMessage(
|
|
892
|
+
jid,
|
|
893
|
+
{
|
|
894
|
+
protocolMessage: {
|
|
895
|
+
type: 30,
|
|
896
|
+
memberLabel: {
|
|
897
|
+
label: ''
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
{}
|
|
902
|
+
)
|
|
903
|
+
} catch (e) {
|
|
904
|
+
logger.error('Failed removeLabelMember: ' + e)
|
|
905
|
+
throw e
|
|
906
|
+
}
|
|
907
|
+
}
|
|
860
908
|
const addLabel = (jid, labels) => {
|
|
861
909
|
return chatModify({ addLabel: { ...labels } }, jid);
|
|
862
910
|
};
|
|
@@ -1079,7 +1127,9 @@ const getBusinessProfile = async (jid) => {
|
|
|
1079
1127
|
removeChatLabel,
|
|
1080
1128
|
addMessageLabel,
|
|
1081
1129
|
removeMessageLabel,
|
|
1082
|
-
star
|
|
1130
|
+
star,
|
|
1131
|
+
addLabelMember,
|
|
1132
|
+
removeLabelMember
|
|
1083
1133
|
};
|
|
1084
1134
|
};
|
|
1085
1135
|
exports.makeChatsSocket = makeChatsSocket;
|
|
@@ -780,10 +780,10 @@ const makeMessagesSocket = (config) => {
|
|
|
780
780
|
}
|
|
781
781
|
return albumMsg;
|
|
782
782
|
}
|
|
783
|
-
else if (
|
|
784
|
-
|
|
783
|
+
else if (content.groupStatusMessage) {
|
|
784
|
+
const { quoted } = options;
|
|
785
785
|
return await rexx.handleGroupStory(content, jid, quoted);
|
|
786
|
-
}
|
|
786
|
+
}
|
|
787
787
|
else {
|
|
788
788
|
let mediaHandle;
|
|
789
789
|
const fullMsg = await (0, Utils_1.generateWAMessage)(jid, content, {
|
|
@@ -816,7 +816,7 @@ const makeMessagesSocket = (config) => {
|
|
|
816
816
|
const isPinMsg = 'pin' in content && !!content.pin;
|
|
817
817
|
const isKeepMsg = 'keep' in content && content.keep;
|
|
818
818
|
const isPollMessage = 'poll' in content && !!content.poll;
|
|
819
|
-
const isAiMsg =
|
|
819
|
+
const isAiMsg = content && content.ai === true;
|
|
820
820
|
const additionalAttributes = {};
|
|
821
821
|
const additionalNodes = [];
|
|
822
822
|
// required for delete
|
|
@@ -851,13 +851,15 @@ const makeMessagesSocket = (config) => {
|
|
|
851
851
|
});
|
|
852
852
|
// required to display AI icon on message
|
|
853
853
|
}
|
|
854
|
+
|
|
854
855
|
else if (isAiMsg) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
856
|
+
msg.messageContextInfo = {
|
|
857
|
+
...(msg.messageContextInfo || {}),
|
|
858
|
+
businessMessageType: 3,
|
|
859
|
+
aiMessageMetadata: {
|
|
860
|
+
isAiMessage: true
|
|
861
|
+
}
|
|
862
|
+
};
|
|
861
863
|
}
|
|
862
864
|
if (mediaHandle) {
|
|
863
865
|
additionalAttributes['media_id'] = mediaHandle;
|