@d0v3riz/baileys 6.7.21 → 6.7.22
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/WAProto/GenerateStatics.sh +2 -3
- package/WAProto/index.js +4138 -4136
- package/lib/Defaults/index.d.ts +2 -3
- package/lib/Defaults/index.js +40 -36
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
- package/lib/Signal/Group/ciphertext-message.js +5 -2
- package/lib/Signal/Group/group-session-builder.d.ts +3 -4
- package/lib/Signal/Group/group-session-builder.js +41 -7
- package/lib/Signal/Group/group_cipher.d.ts +2 -3
- package/lib/Signal/Group/group_cipher.js +16 -14
- package/lib/Signal/Group/index.d.ts +11 -12
- package/lib/Signal/Group/index.js +57 -12
- package/lib/Signal/Group/keyhelper.d.ts +1 -2
- package/lib/Signal/Group/keyhelper.js +44 -8
- package/lib/Signal/Group/queue-job.d.ts +0 -2
- package/lib/Signal/Group/queue-job.js +5 -5
- package/lib/Signal/Group/sender-chain-key.d.ts +1 -2
- package/lib/Signal/Group/sender-chain-key.js +9 -7
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-distribution-message.js +9 -6
- package/lib/Signal/Group/sender-key-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-message.js +12 -10
- package/lib/Signal/Group/sender-key-name.d.ts +0 -1
- package/lib/Signal/Group/sender-key-name.js +5 -2
- package/lib/Signal/Group/sender-key-record.d.ts +1 -2
- package/lib/Signal/Group/sender-key-record.js +12 -9
- package/lib/Signal/Group/sender-key-state.d.ts +2 -3
- package/lib/Signal/Group/sender-key-state.js +9 -6
- package/lib/Signal/Group/sender-message-key.d.ts +0 -1
- package/lib/Signal/Group/sender-message-key.js +7 -5
- package/lib/Signal/libsignal.d.ts +2 -3
- package/lib/Signal/libsignal.js +55 -22
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +18 -3
- package/lib/Socket/Client/types.d.ts +1 -2
- package/lib/Socket/Client/types.js +6 -4
- package/lib/Socket/Client/websocket.d.ts +1 -2
- package/lib/Socket/Client/websocket.js +26 -14
- package/lib/Socket/business.d.ts +64 -66
- package/lib/Socket/business.js +37 -32
- package/lib/Socket/chats.d.ts +19 -21
- package/lib/Socket/chats.js +141 -176
- package/lib/Socket/groups.d.ts +35 -37
- package/lib/Socket/groups.js +63 -56
- package/lib/Socket/index.d.ts +70 -102
- package/lib/Socket/index.js +9 -16
- package/lib/Socket/messages-recv.d.ts +49 -51
- package/lib/Socket/messages-recv.js +173 -180
- package/lib/Socket/messages-send.d.ts +46 -48
- package/lib/Socket/messages-send.js +84 -75
- package/lib/Socket/mex.d.ts +1 -2
- package/lib/Socket/mex.js +16 -12
- package/lib/Socket/newsletter.d.ts +44 -46
- package/lib/Socket/newsletter.js +27 -23
- package/lib/Socket/socket.d.ts +12 -13
- package/lib/Socket/socket.js +115 -135
- package/lib/Socket/usync.d.ts +14 -15
- package/lib/Socket/usync.js +11 -9
- package/lib/Types/Auth.d.ts +3 -4
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.d.ts +0 -1
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +7 -10
- package/lib/Types/Chat.js +4 -2
- package/lib/Types/Contact.d.ts +0 -1
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +10 -11
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +2 -3
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +0 -1
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.d.ts +7 -9
- package/lib/Types/Message.js +7 -7
- package/lib/Types/Newsletter.d.ts +0 -1
- package/lib/Types/Newsletter.js +7 -5
- package/lib/Types/Product.d.ts +1 -2
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +1 -2
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +7 -8
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.d.ts +2 -14
- package/lib/Types/State.js +2 -13
- package/lib/Types/USync.d.ts +2 -3
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +14 -15
- package/lib/Types/index.js +31 -15
- package/lib/Utils/auth-utils.d.ts +2 -3
- package/lib/Utils/auth-utils.js +34 -25
- package/lib/Utils/baileys-event-stream.d.ts +1 -2
- package/lib/Utils/baileys-event-stream.js +22 -15
- package/lib/Utils/business.d.ts +2 -3
- package/lib/Utils/business.js +70 -61
- package/lib/Utils/chat-utils.d.ts +7 -8
- package/lib/Utils/chat-utils.js +137 -130
- package/lib/Utils/crypto.d.ts +1 -2
- package/lib/Utils/crypto.js +86 -37
- package/lib/Utils/decode-wa-message.d.ts +4 -5
- package/lib/Utils/decode-wa-message.js +44 -38
- package/lib/Utils/event-buffer.d.ts +4 -4
- package/lib/Utils/event-buffer.js +50 -37
- package/lib/Utils/generics.d.ts +8 -9
- package/lib/Utils/generics.js +114 -87
- package/lib/Utils/history.d.ts +3 -4
- package/lib/Utils/history.js +40 -32
- package/lib/Utils/index.d.ts +17 -18
- package/lib/Utils/index.js +33 -18
- package/lib/Utils/link-preview.d.ts +3 -4
- package/lib/Utils/link-preview.js +47 -10
- package/lib/Utils/logger.d.ts +6 -8
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +8 -9
- package/lib/Utils/lt-hash.js +26 -23
- package/lib/Utils/make-mutex.d.ts +0 -1
- package/lib/Utils/make-mutex.js +9 -5
- package/lib/Utils/messages-media.d.ts +10 -11
- package/lib/Utils/messages-media.js +203 -141
- package/lib/Utils/messages.d.ts +6 -7
- package/lib/Utils/messages.js +199 -190
- package/lib/Utils/noise-handler.d.ts +4 -5
- package/lib/Utils/noise-handler.js +26 -22
- package/lib/Utils/process-message.d.ts +4 -5
- package/lib/Utils/process-message.js +104 -95
- package/lib/Utils/signal.d.ts +4 -5
- package/lib/Utils/signal.js +52 -47
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
- package/lib/Utils/use-multi-file-auth-state.js +26 -23
- package/lib/Utils/validate-connection.d.ts +3 -4
- package/lib/Utils/validate-connection.js +58 -52
- package/lib/WABinary/constants.d.ts +0 -1
- package/lib/WABinary/constants.js +11 -9
- package/lib/WABinary/decode.d.ts +1 -2
- package/lib/WABinary/decode.js +51 -13
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +41 -5
- package/lib/WABinary/generic-utils.d.ts +3 -4
- package/lib/WABinary/generic-utils.js +38 -30
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.d.ts +0 -1
- package/lib/WABinary/jid-utils.js +35 -21
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +1 -2
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.d.ts +0 -1
- package/lib/WAM/constants.js +6 -4
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAM/encode.js +14 -12
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +19 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +9 -6
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +12 -9
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -6
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +11 -7
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +21 -19
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +5 -2
- package/lib/WAUSync/Protocols/index.d.ts +4 -5
- package/lib/WAUSync/Protocols/index.js +20 -5
- package/lib/WAUSync/USyncQuery.d.ts +3 -4
- package/lib/WAUSync/USyncQuery.js +20 -18
- package/lib/WAUSync/USyncUser.d.ts +5 -6
- package/lib/WAUSync/USyncUser.js +5 -2
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.d.ts +8 -9
- package/lib/index.js +30 -11
- package/package.json +26 -26
- package/WAProto/fix-imports.js +0 -29
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/queue-job.d.ts.map +0 -1
- package/lib/Signal/Group/queue-job.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts +0 -219
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js +0 -351
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Socket/usync.d.ts.map +0 -1
- package/lib/Socket/usync.js.map +0 -1
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/baileys-event-stream.d.ts.map +0 -1
- package/lib/Utils/baileys-event-stream.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- package/lib/WABinary/generic-utils.d.ts.map +0 -1
- package/lib/WABinary/generic-utils.js.map +0 -1
- package/lib/WABinary/index.d.ts.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- package/lib/WABinary/jid-utils.d.ts.map +0 -1
- package/lib/WABinary/jid-utils.js.map +0 -1
- package/lib/WABinary/types.d.ts.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { proto } from '../../WAProto
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { proto } from '../../WAProto';
|
|
2
|
+
import { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types';
|
|
3
|
+
import { BinaryNode } from '../WABinary';
|
|
4
4
|
export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
5
5
|
groupMetadata: (jid: string) => Promise<GroupMetadata>;
|
|
6
6
|
groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
|
|
@@ -11,11 +11,11 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
11
11
|
}[]>;
|
|
12
12
|
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
13
13
|
status: string;
|
|
14
|
-
jid: string
|
|
14
|
+
jid: string;
|
|
15
15
|
}[]>;
|
|
16
16
|
groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
|
|
17
17
|
status: string;
|
|
18
|
-
jid: string
|
|
18
|
+
jid: string;
|
|
19
19
|
content: BinaryNode;
|
|
20
20
|
}[]>;
|
|
21
21
|
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
@@ -43,16 +43,16 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
43
43
|
groupFetchAllParticipating: () => Promise<{
|
|
44
44
|
[_: string]: GroupMetadata;
|
|
45
45
|
}>;
|
|
46
|
-
getBotListV2: () => Promise<import("../Types
|
|
46
|
+
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
47
47
|
processingMutex: {
|
|
48
48
|
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
49
49
|
};
|
|
50
50
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
51
51
|
[_: string]: string;
|
|
52
52
|
}>;
|
|
53
|
-
upsertMessage: (msg: import("../Types
|
|
54
|
-
appPatch: (patchCreate: import("../Types
|
|
55
|
-
sendPresenceUpdate: (type: import("../Types
|
|
53
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
54
|
+
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
55
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
56
56
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
57
57
|
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
58
58
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
@@ -60,10 +60,10 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
60
60
|
exists: unknown;
|
|
61
61
|
lid: unknown;
|
|
62
62
|
}[] | undefined>;
|
|
63
|
-
fetchBlocklist: () => Promise<
|
|
64
|
-
fetchStatus: (...jids: string[]) => Promise<import("
|
|
65
|
-
fetchDisappearingDuration: (...jids: string[]) => Promise<import("
|
|
66
|
-
updateProfilePicture: (jid: string, content: import("../Types
|
|
63
|
+
fetchBlocklist: () => Promise<string[]>;
|
|
64
|
+
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
65
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
66
|
+
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload, dimensions?: {
|
|
67
67
|
width: number;
|
|
68
68
|
height: number;
|
|
69
69
|
}) => Promise<void>;
|
|
@@ -71,23 +71,22 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
71
71
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
72
72
|
updateProfileName: (name: string) => Promise<void>;
|
|
73
73
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
updateGroupsAddPrivacy: (value: import("../Types/index.js").WAPrivacyGroupAddValue) => Promise<void>;
|
|
74
|
+
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
75
|
+
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
76
|
+
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
77
|
+
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
78
|
+
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
79
|
+
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
80
|
+
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
81
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
83
82
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
84
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types
|
|
83
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
85
84
|
resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
86
|
-
chatModify: (mod: import("../Types
|
|
85
|
+
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
87
86
|
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
88
87
|
addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
|
|
89
88
|
removeContact: (jid: string) => Promise<void>;
|
|
90
|
-
addLabel: (jid: string, labels: import("../Types/Label
|
|
89
|
+
addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
|
|
91
90
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
92
91
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
93
92
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
@@ -96,25 +95,25 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
96
95
|
id: string;
|
|
97
96
|
fromMe?: boolean;
|
|
98
97
|
}[], star: boolean) => Promise<void>;
|
|
99
|
-
executeUSyncQuery: (usyncQuery: import("
|
|
98
|
+
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
100
99
|
type: "md";
|
|
101
|
-
ws: import("./Client
|
|
102
|
-
ev: import("../Types
|
|
103
|
-
process(handler: (events: Partial<import("../Types
|
|
100
|
+
ws: import("./Client").WebSocketClient;
|
|
101
|
+
ev: import("../Types").BaileysEventEmitter & {
|
|
102
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
104
103
|
buffer(): void;
|
|
105
104
|
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
|
|
106
|
-
flush(): boolean;
|
|
105
|
+
flush(force?: boolean): boolean;
|
|
107
106
|
isBuffering(): boolean;
|
|
108
107
|
};
|
|
109
108
|
authState: {
|
|
110
|
-
creds: import("../Types
|
|
111
|
-
keys: import("../Types
|
|
109
|
+
creds: import("../Types").AuthenticationCreds;
|
|
110
|
+
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
112
111
|
};
|
|
113
|
-
signalRepository: import("../Types
|
|
114
|
-
user: import("../Types
|
|
112
|
+
signalRepository: import("../Types").SignalRepository;
|
|
113
|
+
user: import("../Types").Contact | undefined;
|
|
115
114
|
generateMessageTag: () => string;
|
|
116
115
|
query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
117
|
-
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<
|
|
116
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
118
117
|
waitForSocketOpen: () => Promise<void>;
|
|
119
118
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
120
119
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
@@ -124,9 +123,8 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
124
123
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
125
124
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
126
125
|
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
|
127
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types
|
|
126
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
128
127
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
129
128
|
};
|
|
130
129
|
export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
|
|
131
130
|
export type GroupsSocket = ReturnType<typeof makeGroupsSocket>;
|
|
132
|
-
//# sourceMappingURL=groups.d.ts.map
|
package/lib/Socket/groups.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractGroupMetadata = exports.makeGroupsSocket = void 0;
|
|
4
|
+
const WAProto_1 = require("../../WAProto");
|
|
5
|
+
const Types_1 = require("../Types");
|
|
6
|
+
const Utils_1 = require("../Utils");
|
|
7
|
+
const WABinary_1 = require("../WABinary");
|
|
8
|
+
const chats_1 = require("./chats");
|
|
9
|
+
const makeGroupsSocket = (config) => {
|
|
10
|
+
const sock = (0, chats_1.makeChatsSocket)(config);
|
|
8
11
|
const { authState, ev, query, upsertMessage } = sock;
|
|
9
12
|
const groupQuery = async (jid, type, content) => query({
|
|
10
13
|
tag: 'iq',
|
|
@@ -17,7 +20,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
17
20
|
});
|
|
18
21
|
const groupMetadata = async (jid) => {
|
|
19
22
|
const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
20
|
-
return extractGroupMetadata(result);
|
|
23
|
+
return (0, exports.extractGroupMetadata)(result);
|
|
21
24
|
};
|
|
22
25
|
const groupFetchAllParticipating = async () => {
|
|
23
26
|
const result = await query({
|
|
@@ -39,11 +42,11 @@ export const makeGroupsSocket = (config) => {
|
|
|
39
42
|
]
|
|
40
43
|
});
|
|
41
44
|
const data = {};
|
|
42
|
-
const groupsChild = getBinaryNodeChild(result, 'groups');
|
|
45
|
+
const groupsChild = (0, WABinary_1.getBinaryNodeChild)(result, 'groups');
|
|
43
46
|
if (groupsChild) {
|
|
44
|
-
const groups = getBinaryNodeChildren(groupsChild, 'group');
|
|
47
|
+
const groups = (0, WABinary_1.getBinaryNodeChildren)(groupsChild, 'group');
|
|
45
48
|
for (const groupNode of groups) {
|
|
46
|
-
const meta = extractGroupMetadata({
|
|
49
|
+
const meta = (0, exports.extractGroupMetadata)({
|
|
47
50
|
tag: 'result',
|
|
48
51
|
attrs: {},
|
|
49
52
|
content: [groupNode]
|
|
@@ -55,7 +58,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
55
58
|
return data;
|
|
56
59
|
};
|
|
57
60
|
sock.ws.on('CB:ib,,dirty', async (node) => {
|
|
58
|
-
const { attrs } = getBinaryNodeChild(node, 'dirty');
|
|
61
|
+
const { attrs } = (0, WABinary_1.getBinaryNodeChild)(node, 'dirty');
|
|
59
62
|
if (attrs.type !== 'groups') {
|
|
60
63
|
return;
|
|
61
64
|
}
|
|
@@ -66,7 +69,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
66
69
|
...sock,
|
|
67
70
|
groupMetadata,
|
|
68
71
|
groupCreate: async (subject, participants) => {
|
|
69
|
-
const key = generateMessageIDV2();
|
|
72
|
+
const key = (0, Utils_1.generateMessageIDV2)();
|
|
70
73
|
const result = await groupQuery('@g.us', 'set', [
|
|
71
74
|
{
|
|
72
75
|
tag: 'create',
|
|
@@ -80,7 +83,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
80
83
|
}))
|
|
81
84
|
}
|
|
82
85
|
]);
|
|
83
|
-
return extractGroupMetadata(result);
|
|
86
|
+
return (0, exports.extractGroupMetadata)(result);
|
|
84
87
|
},
|
|
85
88
|
groupLeave: async (id) => {
|
|
86
89
|
await groupQuery('@g.us', 'set', [
|
|
@@ -107,8 +110,8 @@ export const makeGroupsSocket = (config) => {
|
|
|
107
110
|
attrs: {}
|
|
108
111
|
}
|
|
109
112
|
]);
|
|
110
|
-
const node = getBinaryNodeChild(result, 'membership_approval_requests');
|
|
111
|
-
const participants = getBinaryNodeChildren(node, 'membership_approval_request');
|
|
113
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'membership_approval_requests');
|
|
114
|
+
const participants = (0, WABinary_1.getBinaryNodeChildren)(node, 'membership_approval_request');
|
|
112
115
|
return participants.map(v => v.attrs);
|
|
113
116
|
},
|
|
114
117
|
groupRequestParticipantsUpdate: async (jid, participants, action) => {
|
|
@@ -128,9 +131,9 @@ export const makeGroupsSocket = (config) => {
|
|
|
128
131
|
]
|
|
129
132
|
}
|
|
130
133
|
]);
|
|
131
|
-
const node = getBinaryNodeChild(result, 'membership_requests_action');
|
|
132
|
-
const nodeAction = getBinaryNodeChild(node, action);
|
|
133
|
-
const participantsAffected = getBinaryNodeChildren(nodeAction, 'participant');
|
|
134
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'membership_requests_action');
|
|
135
|
+
const nodeAction = (0, WABinary_1.getBinaryNodeChild)(node, action);
|
|
136
|
+
const participantsAffected = (0, WABinary_1.getBinaryNodeChildren)(nodeAction, 'participant');
|
|
134
137
|
return participantsAffected.map(p => {
|
|
135
138
|
return { status: p.attrs.error || '200', jid: p.attrs.jid };
|
|
136
139
|
});
|
|
@@ -146,20 +149,21 @@ export const makeGroupsSocket = (config) => {
|
|
|
146
149
|
}))
|
|
147
150
|
}
|
|
148
151
|
]);
|
|
149
|
-
const node = getBinaryNodeChild(result, action);
|
|
150
|
-
const participantsAffected = getBinaryNodeChildren(node, 'participant');
|
|
152
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, action);
|
|
153
|
+
const participantsAffected = (0, WABinary_1.getBinaryNodeChildren)(node, 'participant');
|
|
151
154
|
return participantsAffected.map(p => {
|
|
152
155
|
return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
|
|
153
156
|
});
|
|
154
157
|
},
|
|
155
158
|
groupUpdateDescription: async (jid, description) => {
|
|
159
|
+
var _a;
|
|
156
160
|
const metadata = await groupMetadata(jid);
|
|
157
|
-
const prev = metadata.descId
|
|
161
|
+
const prev = (_a = metadata.descId) !== null && _a !== void 0 ? _a : null;
|
|
158
162
|
await groupQuery(jid, 'set', [
|
|
159
163
|
{
|
|
160
164
|
tag: 'description',
|
|
161
165
|
attrs: {
|
|
162
|
-
...(description ? { id: generateMessageIDV2() } : { delete: 'true' }),
|
|
166
|
+
...(description ? { id: (0, Utils_1.generateMessageIDV2)() } : { delete: 'true' }),
|
|
163
167
|
...(prev ? { prev } : {})
|
|
164
168
|
},
|
|
165
169
|
content: description ? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
|
|
@@ -168,18 +172,18 @@ export const makeGroupsSocket = (config) => {
|
|
|
168
172
|
},
|
|
169
173
|
groupInviteCode: async (jid) => {
|
|
170
174
|
const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
|
|
171
|
-
const inviteNode = getBinaryNodeChild(result, 'invite');
|
|
172
|
-
return inviteNode
|
|
175
|
+
const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, 'invite');
|
|
176
|
+
return inviteNode === null || inviteNode === void 0 ? void 0 : inviteNode.attrs.code;
|
|
173
177
|
},
|
|
174
178
|
groupRevokeInvite: async (jid) => {
|
|
175
179
|
const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
|
|
176
|
-
const inviteNode = getBinaryNodeChild(result, 'invite');
|
|
177
|
-
return inviteNode
|
|
180
|
+
const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, 'invite');
|
|
181
|
+
return inviteNode === null || inviteNode === void 0 ? void 0 : inviteNode.attrs.code;
|
|
178
182
|
},
|
|
179
183
|
groupAcceptInvite: async (code) => {
|
|
180
184
|
const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
|
|
181
|
-
const result = getBinaryNodeChild(results, 'group');
|
|
182
|
-
return result
|
|
185
|
+
const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
|
|
186
|
+
return result === null || result === void 0 ? void 0 : result.attrs.jid;
|
|
183
187
|
},
|
|
184
188
|
/**
|
|
185
189
|
* revoke a v4 invite for someone
|
|
@@ -199,6 +203,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
199
203
|
* @param inviteMessage the message to accept
|
|
200
204
|
*/
|
|
201
205
|
groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
|
|
206
|
+
var _a;
|
|
202
207
|
key = typeof key === 'string' ? { remoteJid: key } : key;
|
|
203
208
|
const results = await groupQuery(inviteMessage.groupJid, 'set', [
|
|
204
209
|
{
|
|
@@ -214,7 +219,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
214
219
|
// update the invite message to be expired
|
|
215
220
|
if (key.id) {
|
|
216
221
|
// create new invite message that is expired
|
|
217
|
-
inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
222
|
+
inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
218
223
|
inviteMessage.inviteExpiration = 0;
|
|
219
224
|
inviteMessage.inviteCode = '';
|
|
220
225
|
ev.emit('messages.update', [
|
|
@@ -232,20 +237,20 @@ export const makeGroupsSocket = (config) => {
|
|
|
232
237
|
await upsertMessage({
|
|
233
238
|
key: {
|
|
234
239
|
remoteJid: inviteMessage.groupJid,
|
|
235
|
-
id: generateMessageIDV2(sock.user
|
|
240
|
+
id: (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
|
|
236
241
|
fromMe: false,
|
|
237
242
|
participant: key.remoteJid
|
|
238
243
|
},
|
|
239
|
-
messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
244
|
+
messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
240
245
|
messageStubParameters: [authState.creds.me.id],
|
|
241
246
|
participant: key.remoteJid,
|
|
242
|
-
messageTimestamp: unixTimestampSeconds()
|
|
247
|
+
messageTimestamp: (0, Utils_1.unixTimestampSeconds)()
|
|
243
248
|
}, 'notify');
|
|
244
249
|
return results.attrs.from;
|
|
245
250
|
}),
|
|
246
251
|
groupGetInviteInfo: async (code) => {
|
|
247
252
|
const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]);
|
|
248
|
-
return extractGroupMetadata(results);
|
|
253
|
+
return (0, exports.extractGroupMetadata)(results);
|
|
249
254
|
},
|
|
250
255
|
groupToggleEphemeral: async (jid, ephemeralExpiration) => {
|
|
251
256
|
const content = ephemeralExpiration
|
|
@@ -267,24 +272,26 @@ export const makeGroupsSocket = (config) => {
|
|
|
267
272
|
groupFetchAllParticipating
|
|
268
273
|
};
|
|
269
274
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
275
|
+
exports.makeGroupsSocket = makeGroupsSocket;
|
|
276
|
+
const extractGroupMetadata = (result) => {
|
|
277
|
+
var _a, _b;
|
|
278
|
+
const group = (0, WABinary_1.getBinaryNodeChild)(result, 'group');
|
|
279
|
+
const descChild = (0, WABinary_1.getBinaryNodeChild)(group, 'description');
|
|
273
280
|
let desc;
|
|
274
281
|
let descId;
|
|
275
282
|
let descOwner;
|
|
276
283
|
let descOwnerJid;
|
|
277
284
|
let descTime;
|
|
278
285
|
if (descChild) {
|
|
279
|
-
desc = getBinaryNodeChildString(descChild, 'body');
|
|
280
|
-
descOwner = descChild.attrs.participant ? jidNormalizedUser(descChild.attrs.participant) : undefined;
|
|
281
|
-
descOwnerJid = descChild.attrs.participant_pn ? jidNormalizedUser(descChild.attrs.participant_pn) : undefined;
|
|
286
|
+
desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, 'body');
|
|
287
|
+
descOwner = descChild.attrs.participant ? (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant) : undefined;
|
|
288
|
+
descOwnerJid = descChild.attrs.participant_pn ? (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant_pn) : undefined;
|
|
282
289
|
descTime = +descChild.attrs.t;
|
|
283
290
|
descId = descChild.attrs.id;
|
|
284
291
|
}
|
|
285
|
-
const groupId = group.attrs.id.includes('@') ? group.attrs.id : jidEncode(group.attrs.id, 'g.us');
|
|
286
|
-
const eph = getBinaryNodeChild(group, 'ephemeral')
|
|
287
|
-
const memberAddMode = getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add';
|
|
292
|
+
const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, 'g.us');
|
|
293
|
+
const eph = (_a = (0, WABinary_1.getBinaryNodeChild)(group, 'ephemeral')) === null || _a === void 0 ? void 0 : _a.attrs.expiration;
|
|
294
|
+
const memberAddMode = (0, WABinary_1.getBinaryNodeChildString)(group, 'member_add_mode') === 'all_member_add';
|
|
288
295
|
const metadata = {
|
|
289
296
|
id: groupId,
|
|
290
297
|
addressingMode: group.attrs.addressing_mode,
|
|
@@ -292,28 +299,28 @@ export const extractGroupMetadata = (result) => {
|
|
|
292
299
|
subjectOwner: group.attrs.s_o,
|
|
293
300
|
subjectOwnerJid: group.attrs.s_o_pn,
|
|
294
301
|
subjectTime: +group.attrs.s_t,
|
|
295
|
-
size:
|
|
302
|
+
size: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
|
|
296
303
|
creation: +group.attrs.creation,
|
|
297
|
-
owner: group.attrs.creator ? jidNormalizedUser(group.attrs.creator) : undefined,
|
|
298
|
-
ownerJid: group.attrs.creator_pn ? jidNormalizedUser(group.attrs.creator_pn) : undefined,
|
|
304
|
+
owner: group.attrs.creator ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) : undefined,
|
|
305
|
+
ownerJid: group.attrs.creator_pn ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn) : undefined,
|
|
299
306
|
owner_country_code: group.attrs.creator_country_code,
|
|
300
307
|
desc,
|
|
301
308
|
descId,
|
|
302
309
|
descOwner,
|
|
303
310
|
descOwnerJid,
|
|
304
311
|
descTime,
|
|
305
|
-
linkedParent: getBinaryNodeChild(group, 'linked_parent')
|
|
306
|
-
restrict: !!getBinaryNodeChild(group, 'locked'),
|
|
307
|
-
announce: !!getBinaryNodeChild(group, 'announcement'),
|
|
308
|
-
isCommunity: !!getBinaryNodeChild(group, 'parent'),
|
|
309
|
-
isCommunityAnnounce: !!getBinaryNodeChild(group, 'default_sub_group'),
|
|
310
|
-
joinApprovalMode: !!getBinaryNodeChild(group, 'membership_approval_mode'),
|
|
312
|
+
linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
|
|
313
|
+
restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
|
|
314
|
+
announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
|
|
315
|
+
isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, 'parent'),
|
|
316
|
+
isCommunityAnnounce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'default_sub_group'),
|
|
317
|
+
joinApprovalMode: !!(0, WABinary_1.getBinaryNodeChild)(group, 'membership_approval_mode'),
|
|
311
318
|
memberAddMode,
|
|
312
|
-
participants: getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
319
|
+
participants: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').map(({ attrs }) => {
|
|
313
320
|
return {
|
|
314
321
|
id: attrs.jid,
|
|
315
|
-
jid: isJidUser(attrs.jid) ? attrs.jid : jidNormalizedUser(attrs.phone_number),
|
|
316
|
-
lid: isLidUser(attrs.jid) ? attrs.jid : attrs.lid,
|
|
322
|
+
jid: (0, WABinary_1.isJidUser)(attrs.jid) ? attrs.jid : (0, WABinary_1.jidNormalizedUser)(attrs.phone_number),
|
|
323
|
+
lid: (0, WABinary_1.isLidUser)(attrs.jid) ? attrs.jid : attrs.lid,
|
|
317
324
|
admin: (attrs.type || null)
|
|
318
325
|
};
|
|
319
326
|
}),
|
|
@@ -321,4 +328,4 @@ export const extractGroupMetadata = (result) => {
|
|
|
321
328
|
};
|
|
322
329
|
return metadata;
|
|
323
330
|
};
|
|
324
|
-
|
|
331
|
+
exports.extractGroupMetadata = extractGroupMetadata;
|