@ellxz24/baileys 2.0.31 → 2.0.32
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/Defaults/index.js +3 -3
- package/lib/Socket/newsletter.js +52 -22
- package/package.json +1 -1
- package/lib/Signal/libsignal.js.bak +0 -356
- package/lib/Signal/lid-mapping.js.bak +0 -166
- package/lib/Socket/socket.js.bak +0 -718
- package/lib/WABinary/jid-utils.js.bak +0 -62
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jidNormalizedUser = exports.isJidNewsLetter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
|
|
4
|
-
exports.S_WHATSAPP_NET = '@s.whatsapp.net';
|
|
5
|
-
exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
|
|
6
|
-
exports.SERVER_JID = 'server@c.us';
|
|
7
|
-
exports.PSA_WID = '0@c.us';
|
|
8
|
-
exports.STORIES_JID = 'status@broadcast';
|
|
9
|
-
const jidEncode = (user, server, device, agent) => {
|
|
10
|
-
return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}`;
|
|
11
|
-
};
|
|
12
|
-
exports.jidEncode = jidEncode;
|
|
13
|
-
const jidDecode = (jid) => {
|
|
14
|
-
const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
|
|
15
|
-
if (sepIdx < 0) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
const server = jid.slice(sepIdx + 1);
|
|
19
|
-
const userCombined = jid.slice(0, sepIdx);
|
|
20
|
-
const [userAgent, device] = userCombined.split(':');
|
|
21
|
-
const user = userAgent.split('_')[0];
|
|
22
|
-
return {
|
|
23
|
-
server,
|
|
24
|
-
user,
|
|
25
|
-
domainType: server === 'lid' ? 1 : 0,
|
|
26
|
-
device: device ? +device : undefined
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
exports.jidDecode = jidDecode;
|
|
30
|
-
/** is the jid a user */
|
|
31
|
-
const areJidsSameUser = (jid1, jid2) => {
|
|
32
|
-
var _a, _b;
|
|
33
|
-
return (((_a = (0, exports.jidDecode)(jid1)) === null || _a === void 0 ? void 0 : _a.user) === ((_b = (0, exports.jidDecode)(jid2)) === null || _b === void 0 ? void 0 : _b.user));
|
|
34
|
-
};
|
|
35
|
-
exports.areJidsSameUser = areJidsSameUser;
|
|
36
|
-
/** is the jid a user */
|
|
37
|
-
const isJidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@s.whatsapp.net'));
|
|
38
|
-
exports.isJidUser = isJidUser;
|
|
39
|
-
/** is the jid a group */
|
|
40
|
-
const isLidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@lid'));
|
|
41
|
-
exports.isLidUser = isLidUser;
|
|
42
|
-
/** is the jid a broadcast */
|
|
43
|
-
const isJidBroadcast = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@broadcast'));
|
|
44
|
-
exports.isJidBroadcast = isJidBroadcast;
|
|
45
|
-
/** is the jid a group */
|
|
46
|
-
const isJidGroup = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@g.us'));
|
|
47
|
-
exports.isJidGroup = isJidGroup;
|
|
48
|
-
/** is the jid the status broadcast */
|
|
49
|
-
const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
|
|
50
|
-
exports.isJidStatusBroadcast = isJidStatusBroadcast;
|
|
51
|
-
/** is the jid the newsletter */
|
|
52
|
-
const isJidNewsLetter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('newsletter'));
|
|
53
|
-
exports.isJidNewsLetter = isJidNewsLetter;
|
|
54
|
-
const jidNormalizedUser = (jid) => {
|
|
55
|
-
const result = (0, exports.jidDecode)(jid);
|
|
56
|
-
if (!result) {
|
|
57
|
-
return '';
|
|
58
|
-
}
|
|
59
|
-
const { user, server } = result;
|
|
60
|
-
return (0, exports.jidEncode)(user, server === 'c.us' ? 's.whatsapp.net' : server);
|
|
61
|
-
};
|
|
62
|
-
exports.jidNormalizedUser = jidNormalizedUser;
|