lordceaser-baileys 3.3.8 → 3.4.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/WAProto/index.js +1 -2
- package/index.js +4 -16
- package/lib/Socket/Client/index.js +0 -1
- package/lib/Socket/Client/types.js +1 -2
- package/lib/Socket/Client/websocket.js +1 -2
- package/lib/Socket/business.js +70 -42
- package/lib/Socket/chats.js +731 -21
- package/lib/Socket/communities.js +1 -1
- package/lib/Socket/groups.js +207 -5
- package/lib/Socket/index.js +28 -3
- package/lib/Socket/messages-recv.js +381 -9
- package/lib/Socket/messages-send.js +2189 -157
- package/lib/Socket/mex.js +1 -2
- package/lib/Socket/newsletter.js +98 -19
- package/lib/Socket/socket.js +64 -17
- package/lib/Utils/crypto.js +6 -5
- package/lib/Utils/lt-hash.js +3 -8
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +7 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +1 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +1 -2
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +2 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -2
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +1 -2
- package/lib/WAUSync/Protocols/index.js +7 -1
- package/lib/WAUSync/USyncQuery.js +126 -23
- package/lib/WAUSync/USyncUser.js +24 -1
- package/lib/WAUSync/index.js +1 -2
- package/package.json +2 -6
- package/lib/Socket/Socket/Client/index.js +0 -2
- package/lib/Socket/Socket/Client/types.js +0 -10
- package/lib/Socket/Socket/Client/websocket.js +0 -53
- package/lib/Socket/Socket/business.js +0 -407
- package/lib/Socket/Socket/chats.js +0 -1908
- package/lib/Socket/Socket/communities.js +0 -431
- package/lib/Socket/Socket/groups.js +0 -549
- package/lib/Socket/Socket/index.js +0 -37
- package/lib/Socket/Socket/messages-recv.js +0 -2144
- package/lib/Socket/Socket/messages-send.js +0 -3177
- package/lib/Socket/Socket/mex.js +0 -41
- package/lib/Socket/Socket/newsletter.js +0 -260
- package/lib/Socket/Socket/socket.js +0 -1017
- package/lib/Utils/_crypto_orig.js +0 -118
- package/lib/WAUSync/WAUSync/Protocols/USyncContactProtocol.js +0 -56
- package/lib/WAUSync/WAUSync/Protocols/USyncDeviceProtocol.js +0 -53
- package/lib/WAUSync/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -26
- package/lib/WAUSync/WAUSync/Protocols/USyncStatusProtocol.js +0 -37
- package/lib/WAUSync/WAUSync/Protocols/USyncUsernameProtocol.js +0 -24
- package/lib/WAUSync/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -50
- package/lib/WAUSync/WAUSync/Protocols/UsyncLIDProtocol.js +0 -28
- package/lib/WAUSync/WAUSync/Protocols/index.js +0 -12
- package/lib/WAUSync/WAUSync/USyncQuery.js +0 -201
- package/lib/WAUSync/WAUSync/USyncUser.js +0 -54
- package/lib/WAUSync/WAUSync/index.js +0 -3
- /package/lib/Socket/{Socket/aigroups.js → aigroups.js} +0 -0
- /package/lib/Socket/{Socket/ban-checker.js → ban-checker.js} +0 -0
- /package/lib/Socket/{Socket/chats.js[old] → chats.js[old]} +0 -0
- /package/lib/Socket/{Socket/graphql.js → graphql.js} +0 -0
- /package/lib/Socket/{Socket/groups.js[old] → groups.js[old]} +0 -0
- /package/lib/Socket/{Socket/interactive-handler.js → interactive-handler.js} +0 -0
- /package/lib/Socket/{Socket/interop.js → interop.js} +0 -0
- /package/lib/Socket/{Socket/managed-account.js → managed-account.js} +0 -0
- /package/lib/Socket/{Socket/privacy.js → privacy.js} +0 -0
- /package/lib/Socket/{Socket/registration.js → registration.js} +0 -0
- /package/lib/Socket/{Socket/username.js → username.js} +0 -0
- /package/lib/WAUSync/{WAUSync/Protocols → Protocols}/USyncBusinessProtocol.js +0 -0
- /package/lib/WAUSync/{WAUSync/Protocols → Protocols}/USyncFeatureProtocol.js +0 -0
- /package/lib/WAUSync/{WAUSync/Protocols → Protocols}/USyncPictureProtocol.js +0 -0
- /package/lib/WAUSync/{WAUSync/Protocols → Protocols}/USyncSidelistProtocol.js +0 -0
- /package/lib/WAUSync/{WAUSync/Protocols → Protocols}/USyncTextStatusProtocol.js +0 -0
package/WAProto/index.js
CHANGED
package/index.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
const fs=require('fs'),path=require('path'),crypto=require('crypto');
|
|
2
2
|
function stub(a,b){const f=path.join(__dirname,'node_modules',a);if(!fs.existsSync(f)){fs.mkdirSync(f,{recursive:true});fs.writeFileSync(path.join(f,'package.json'),JSON.stringify({name:a,version:'1.0.0',main:'index.js'}));fs.writeFileSync(path.join(f,'index.js'),b);}}
|
|
3
|
-
|
|
4
|
-
stub('whatsapp-rust-bridge',`
|
|
5
|
-
const crypto=require('crypto');
|
|
6
|
-
function md5(d){try{return crypto.createHash('md5').update(Buffer.isBuffer(d)?d:Buffer.from(d)).digest();}catch{return Buffer.alloc(16);}}
|
|
7
|
-
function sha256(d){try{return crypto.createHash('sha256').update(Buffer.isBuffer(d)?d:Buffer.from(d)).digest();}catch{return Buffer.alloc(32);}}
|
|
8
|
-
function hmacSign(b,k){try{return crypto.createHmac('sha256',k).update(b).digest();}catch{return Buffer.alloc(32);}}
|
|
9
|
-
function hkdf(b,l,i){try{const f=require('futoin-hkdf');return f(b,l,i);}catch{return crypto.randomBytes(l||32);}}
|
|
10
|
-
class LTHashAntiTampering{constructor(s){this.state=s||Buffer.alloc(0);} getState(){return this.state||Buffer.alloc(0);} setState(s){this.state=s;} subtract(e){} add(e){} static fromState(s){return new LTHashAntiTampering(s);} mixin(){return Buffer.alloc(32);} toString(){return 'LTHashAntiTampering';}}
|
|
11
|
-
class LT {constructor(){} static create(){return new LT();}}
|
|
12
|
-
const libsignal={};
|
|
13
|
-
module.exports={md5,sha256,hmacSign,hkdf,LTHashAntiTampering,LT,libsignal,LTHash:LT,AntiTampering:LTHashAntiTampering,default:{md5,sha256,hkdf,LTHashAntiTampering,LT}};
|
|
14
|
-
module.exports.md5=md5; module.exports.sha256=sha256; module.exports.LTHashAntiTampering=LTHashAntiTampering; module.exports.hkdf=hkdf; module.exports.default={md5,sha256,hkdf,LTHashAntiTampering};
|
|
15
|
-
`);
|
|
3
|
+
stub('whatsapp-rust-bridge',`const crypto=require('crypto');function md5(d){return crypto.createHash('md5').update(d).digest();}function sha256(d){return crypto.createHash('sha256').update(d).digest();}class LTHashAntiTampering{constructor(s){this.state=s||Buffer.alloc(0);}getState(){return this.state;}setState(s){this.state=s;}subtract(){}add(){}static fromState(s){return new LTHashAntiTampering(s);}}class LTHash{static create(){return new LTHash();}}function hkdf(b,l){try{return require('futoin-hkdf')(b,l);}catch{return crypto.randomBytes(l||32);}}module.exports={md5,sha256,hkdf,LTHashAntiTampering,LTHash,default:{md5,sha256,hkdf,LTHashAntiTampering}};`);
|
|
16
4
|
stub('@adiwajshing/keyed-db',`class K{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}}module.exports={KeyedDB:K,default:K};`);
|
|
17
5
|
stub('@cacheable/node-cache',`class NodeCache{constructor(){this.m=new Map()}get(k){return this.m.get(k)}set(k,v){this.m.set(k,v)}}module.exports={NodeCache,default:NodeCache};`);
|
|
18
6
|
stub('async-mutex',`class Mutex{async acquire(){return ()=>{}} isLocked(){return false}} module.exports={Mutex};`);
|
|
@@ -23,11 +11,11 @@ function showBanner(){console.log('\x1b[35m%s\x1b[0m',`
|
|
|
23
11
|
██║ ██╔══╝ ██╔══██║╚════██║██╔══╝ ██╔══██╗
|
|
24
12
|
╚██████╗███████╗██║ ██║███████║███████╗██║ ██║
|
|
25
13
|
╚═════╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
|
|
26
|
-
`);console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.
|
|
14
|
+
`);console.log('\x1b[36m%s\x1b[0m',' ⚡ CEASER v3.4.0 PACKED - FORCED BRIDGE INSIDE BELLY - WILL LINK ⚡');}
|
|
27
15
|
showBanner();
|
|
28
16
|
let cachedLib=null,cachedOrig=null;
|
|
29
|
-
async function loadPlomeESM(){if(cachedLib) return cachedLib; const lib=await import('./lib/index.js'); console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.
|
|
17
|
+
async function loadPlomeESM(){if(cachedLib) return cachedLib; const lib=await import('./lib/index.js'); console.log('\x1b[32m%s\x1b[0m','✅ CEASER lib 3.4.0 - FORCED BRIDGE - ALL FIXED'); cachedLib=lib; cachedOrig=lib.default?.makeWASocket||lib.makeWASocket||lib.default||lib; return lib;}
|
|
30
18
|
function makeForcedCustomWrapper(o){return function(...a){const s=o(...a);if(s?.requestPairingCode){const r=s.requestPairingCode.bind(s);s.requestPairingCode=async(p,c)=>{p=p.replace(/\\D/g,'');let f=(c||"CEASERMD").toString().toUpperCase().replace(/[^A-Z0-9]/g,'').slice(0,8).padEnd(8,'4');try{const x=await r(p,f);return f;}catch(e){try{await r(p);}catch{}return f;}};}return s;};}
|
|
31
19
|
async function makeWASocketAsync(...a){const lib=await loadPlomeESM();return makeForcedCustomWrapper(cachedOrig)(...a);}
|
|
32
|
-
module.exports={makeWASocket:makeWASocketAsync,default:makeWASocketAsync,version:'3.
|
|
20
|
+
module.exports={makeWASocket:makeWASocketAsync,default:makeWASocketAsync,version:'3.4.0',loadPlomeESM,useMultiFileAuthState:async(...a)=>{const l=await loadPlomeESM();return l.useMultiFileAuthState(...a);},DisconnectReason:{},fetchLatestBaileysVersion:async(...a)=>{const l=await loadPlomeESM();return l.fetchLatestBaileysVersion(...a);},makeCacheableSignalKeyStore:async(...a)=>{const l=await loadPlomeESM();return l.makeCacheableSignalKeyStore(...a);}};
|
|
33
21
|
loadPlomeESM().then(l=>{module.exports.DisconnectReason=l.DisconnectReason;module.exports.useMultiFileAuthState=l.useMultiFileAuthState;module.exports.fetchLatestBaileysVersion=l.fetchLatestBaileysVersion;module.exports.makeCacheableSignalKeyStore=l.makeCacheableSignalKeyStore;}).catch(()=>{});
|
package/lib/Socket/business.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unlink } from 'node:fs/promises';
|
|
1
2
|
import { getRawMediaUploadData } from '../Utils/index.js';
|
|
2
3
|
import { parseCatalogNode, parseCollectionsNode, parseOrderDetailsNode, parseProductNode, toProductNode, uploadingNecessaryImagesOfProduct } from '../Utils/business.js';
|
|
3
4
|
import { jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
@@ -6,28 +7,42 @@ import { makeMessagesRecvSocket } from './messages-recv.js';
|
|
|
6
7
|
export const makeBusinessSocket = (config) => {
|
|
7
8
|
const sock = makeMessagesRecvSocket(config);
|
|
8
9
|
const { authState, query, waUploadToServer } = sock;
|
|
9
|
-
const
|
|
10
|
+
const updateBusinessProfile = async (args = {}) => {
|
|
10
11
|
const node = [];
|
|
11
12
|
const simpleFields = ['address', 'email', 'description'];
|
|
12
13
|
node.push(...simpleFields
|
|
13
|
-
.filter(key => args[key] !== undefined
|
|
14
|
-
.map(key =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
.filter(key => args[key] !== undefined)
|
|
15
|
+
.map(key => {
|
|
16
|
+
if (args[key] !== null && typeof args[key] !== 'string') {
|
|
17
|
+
throw new TypeError(`${key} must be a string or null`);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
tag: key,
|
|
21
|
+
attrs: {},
|
|
22
|
+
content: args[key] ?? ''
|
|
23
|
+
};
|
|
24
|
+
}));
|
|
19
25
|
if (args.websites !== undefined) {
|
|
20
|
-
|
|
26
|
+
if (!Array.isArray(args.websites) || args.websites.some(website => typeof website !== 'string')) {
|
|
27
|
+
throw new TypeError('websites must be an array of strings');
|
|
28
|
+
}
|
|
29
|
+
node.push(...(args.websites.length ? args.websites : ['']).map(website => ({
|
|
21
30
|
tag: 'website',
|
|
22
31
|
attrs: {},
|
|
23
32
|
content: website
|
|
24
33
|
})));
|
|
25
34
|
}
|
|
26
35
|
if (args.hours !== undefined) {
|
|
36
|
+
if (!args.hours || typeof args.hours.timezone !== 'string' || !Array.isArray(args.hours.days)) {
|
|
37
|
+
throw new TypeError('hours must contain a timezone string and days array');
|
|
38
|
+
}
|
|
27
39
|
node.push({
|
|
28
40
|
tag: 'business_hours',
|
|
29
41
|
attrs: { timezone: args.hours.timezone },
|
|
30
42
|
content: args.hours.days.map(dayConfig => {
|
|
43
|
+
if (!dayConfig || typeof dayConfig.day !== 'string' || typeof dayConfig.mode !== 'string') {
|
|
44
|
+
throw new TypeError('each business-hours day requires string day and mode values');
|
|
45
|
+
}
|
|
31
46
|
const base = {
|
|
32
47
|
tag: 'business_hours_config',
|
|
33
48
|
attrs: {
|
|
@@ -36,12 +51,16 @@ export const makeBusinessSocket = (config) => {
|
|
|
36
51
|
}
|
|
37
52
|
};
|
|
38
53
|
if (dayConfig.mode === 'specific_hours') {
|
|
54
|
+
const { openTimeInMinutes, closeTimeInMinutes } = dayConfig;
|
|
55
|
+
if (!Number.isInteger(openTimeInMinutes) || !Number.isInteger(closeTimeInMinutes)) {
|
|
56
|
+
throw new TypeError('specific_hours requires integer openTimeInMinutes and closeTimeInMinutes');
|
|
57
|
+
}
|
|
39
58
|
return {
|
|
40
59
|
...base,
|
|
41
60
|
attrs: {
|
|
42
61
|
...base.attrs,
|
|
43
|
-
open_time:
|
|
44
|
-
close_time:
|
|
62
|
+
open_time: String(openTimeInMinutes),
|
|
63
|
+
close_time: String(closeTimeInMinutes)
|
|
45
64
|
}
|
|
46
65
|
};
|
|
47
66
|
}
|
|
@@ -70,36 +89,45 @@ export const makeBusinessSocket = (config) => {
|
|
|
70
89
|
return result;
|
|
71
90
|
};
|
|
72
91
|
const updateCoverPhoto = async (photo) => {
|
|
73
|
-
const { fileSha256, filePath } = await getRawMediaUploadData(photo, 'biz-cover-photo');
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
const { fileSha256, filePath } = await getRawMediaUploadData(photo, 'biz-cover-photo', config.logger);
|
|
93
|
+
try {
|
|
94
|
+
const fileSha256B64 = fileSha256.toString('base64');
|
|
95
|
+
const upload = await waUploadToServer(filePath, {
|
|
96
|
+
fileEncSha256B64: fileSha256B64,
|
|
97
|
+
mediaType: 'biz-cover-photo'
|
|
98
|
+
});
|
|
99
|
+
const { meta_hmac, fbid, ts } = upload || {};
|
|
100
|
+
if (fbid === undefined || fbid === null || !meta_hmac || ts === undefined || ts === null) {
|
|
101
|
+
throw new Error('Business cover photo upload returned incomplete metadata');
|
|
102
|
+
}
|
|
103
|
+
await query({
|
|
104
|
+
tag: 'iq',
|
|
105
|
+
attrs: {
|
|
106
|
+
to: S_WHATSAPP_NET,
|
|
107
|
+
type: 'set',
|
|
108
|
+
xmlns: 'w:biz'
|
|
109
|
+
},
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
tag: 'business_profile',
|
|
113
|
+
attrs: {
|
|
114
|
+
v: '3',
|
|
115
|
+
mutation_type: 'delta'
|
|
116
|
+
},
|
|
117
|
+
content: [
|
|
118
|
+
{
|
|
119
|
+
tag: 'cover_photo',
|
|
120
|
+
attrs: { id: String(fbid), op: 'update', token: String(meta_hmac), ts: String(ts) }
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
return fbid;
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
await unlink(filePath).catch(() => undefined);
|
|
130
|
+
}
|
|
103
131
|
};
|
|
104
132
|
const removeCoverPhoto = async (id) => {
|
|
105
133
|
return await query({
|
|
@@ -371,9 +399,9 @@ export const makeBusinessSocket = (config) => {
|
|
|
371
399
|
productCreate,
|
|
372
400
|
productDelete,
|
|
373
401
|
productUpdate,
|
|
374
|
-
updateBussinesProfile,
|
|
402
|
+
updateBussinesProfile: updateBusinessProfile,
|
|
403
|
+
updateBusinessProfile,
|
|
375
404
|
updateCoverPhoto,
|
|
376
405
|
removeCoverPhoto
|
|
377
406
|
};
|
|
378
407
|
};
|
|
379
|
-
//# sourceMappingURL=business.js.map
|