@kanaraa/baileys 3.2.0 → 3.3.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/lib/Socket/groups.js +18 -11
- package/package.json +1 -1
package/lib/Socket/groups.js
CHANGED
|
@@ -16,9 +16,23 @@ export const makeGroupsSocket = (config) => {
|
|
|
16
16
|
},
|
|
17
17
|
content
|
|
18
18
|
});
|
|
19
|
-
const
|
|
19
|
+
const fetchJoinRequests = async (jid) => {
|
|
20
|
+
const req = await groupQuery(jid, 'get', [
|
|
21
|
+
{
|
|
22
|
+
tag: 'membership_approval_requests',
|
|
23
|
+
attrs: {}
|
|
24
|
+
}
|
|
25
|
+
]);
|
|
26
|
+
const node = getBinaryNodeChild(req, 'membership_approval_requests');
|
|
27
|
+
return getBinaryNodeChildren(node, 'membership_approval_request').map(v => v.attrs);
|
|
28
|
+
};
|
|
29
|
+
const groupMetadata = async (jid, opts = {}) => {
|
|
20
30
|
const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
21
|
-
|
|
31
|
+
const metadata = extractGroupMetadata(result);
|
|
32
|
+
if (opts.joinRequests) {
|
|
33
|
+
metadata.joinRequests = await fetchJoinRequests(jid).catch(() => []);
|
|
34
|
+
}
|
|
35
|
+
return metadata;
|
|
22
36
|
};
|
|
23
37
|
const groupFetchAllParticipating = async () => {
|
|
24
38
|
const result = await query({
|
|
@@ -103,15 +117,7 @@ export const makeGroupsSocket = (config) => {
|
|
|
103
117
|
]);
|
|
104
118
|
},
|
|
105
119
|
groupRequestParticipantsList: async (jid) => {
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
tag: 'membership_approval_requests',
|
|
109
|
-
attrs: {}
|
|
110
|
-
}
|
|
111
|
-
]);
|
|
112
|
-
const node = getBinaryNodeChild(result, 'membership_approval_requests');
|
|
113
|
-
const participants = getBinaryNodeChildren(node, 'membership_approval_request');
|
|
114
|
-
return participants.map(v => v.attrs);
|
|
120
|
+
return fetchJoinRequests(jid).catch(() => []);
|
|
115
121
|
},
|
|
116
122
|
groupRequestParticipantsUpdate: async (jid, participants, action) => {
|
|
117
123
|
const result = await groupQuery(jid, 'set', [
|
|
@@ -342,5 +348,6 @@ export const extractGroupMetadata = (result) => {
|
|
|
342
348
|
}),
|
|
343
349
|
ephemeralDuration: eph ? +eph : undefined
|
|
344
350
|
};
|
|
351
|
+
metadata.admins = metadata.participants.filter(p => p.admin);
|
|
345
352
|
return metadata;
|
|
346
353
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanaraa/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"description": "Modded Baileys v7, Rebuilt on top of official @whiskeysockets/baileys 7.0.0-rc13, with the interactive & rich-message content types (buttons, lists, carousel, cards, shop/collection, native flow, AI rich response, sticker packs, admin invite, payments, etc.).",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|