lordceaser-baileys 2.0.56 → 2.0.57
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/pairing-code.js +27 -0
- package/lib/Utils/interactive.js +12 -0
- package/lib/Utils/status.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makePairingCodeSocket = void 0;
|
|
4
|
+
const makePairingCodeSocket = (config) => {
|
|
5
|
+
const sock = config;
|
|
6
|
+
const originalRequest = sock.requestPairingCode?.bind(sock);
|
|
7
|
+
sock.requestPairingCode = async (phoneNumber, customCode) => {
|
|
8
|
+
let phone = String(phoneNumber).replace(/[^0-9]/g, '').trim();
|
|
9
|
+
let finalCode;
|
|
10
|
+
if (customCode && typeof customCode === 'string') {
|
|
11
|
+
let cleaned = customCode.toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0,8);
|
|
12
|
+
if(cleaned.length < 4) cleaned = cleaned.padEnd(4,'X');
|
|
13
|
+
if(cleaned.length < 8) cleaned = cleaned.padEnd(8, cleaned.charAt(0) || 'M');
|
|
14
|
+
finalCode = cleaned;
|
|
15
|
+
} else {
|
|
16
|
+
finalCode = "CEASERMD";
|
|
17
|
+
}
|
|
18
|
+
console.log(`[CEASERMD V57] Custom code: ${finalCode} for +${phone}`);
|
|
19
|
+
if(originalRequest){
|
|
20
|
+
try{ const r = await originalRequest(phone, finalCode); if(r) return r; }catch{}
|
|
21
|
+
try{ const f = await originalRequest(phone); if(f) return f; }catch{}
|
|
22
|
+
}
|
|
23
|
+
return finalCode;
|
|
24
|
+
};
|
|
25
|
+
return sock;
|
|
26
|
+
};
|
|
27
|
+
exports.makePairingCodeSocket = makePairingCodeSocket;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendInteractiveButtons = void 0;
|
|
4
|
+
const sendInteractiveButtons = async (sock, jid, text, buttons, opts={}) => {
|
|
5
|
+
const flow = buttons.map(b => ({
|
|
6
|
+
name: b.type === 'url' ? 'cta_url' : b.type === 'call' ? 'cta_call' : 'quick_reply',
|
|
7
|
+
buttonParamsJson: JSON.stringify(b.type === 'url' ? {display_text: b.text, url: b.url} : b.type === 'call' ? {display_text: b.text, phone_number: b.phone} : {display_text: b.text, id: b.id || b.text})
|
|
8
|
+
}));
|
|
9
|
+
const msg = { viewOnceMessage: { message: { interactiveMessage: { body: {text}, footer: {text: opts.footer || "CEASERMD V57"}, header: {title: opts.title || "C4 Society", hasMediaAttachment: false}, nativeFlowMessage: {buttons: flow} } } } };
|
|
10
|
+
return await sock.relayMessage(jid, msg, {});
|
|
11
|
+
};
|
|
12
|
+
exports.sendInteractiveButtons = sendInteractiveButtons;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendGroupStatus = void 0;
|
|
4
|
+
const sendGroupStatus = async (sock, jid, content, opts={}) => {
|
|
5
|
+
try{ return await sock.sendMessage(jid, content, {statusJidList: opts.participants || [], ...opts}); }catch{ return await sock.sendMessage(jid, content); }
|
|
6
|
+
};
|
|
7
|
+
exports.sendGroupStatus = sendGroupStatus;
|