@rexxhayanasi/elaina-baileys 1.1.1 → 1.1.3
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/README.MD +1 -1
- package/lib/Utils/resolveJid.js +40 -27
- package/package.json +3 -3
package/README.MD
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p><em>Custom WhatsApp library built upon Baileys — enhanced, modernized, and elegant.</em></p>
|
|
6
6
|
<p><strong>🎅 Merry Christmas & Happy New Year 2025 🎅</strong></p>
|
|
7
7
|
|
|
8
|
-
<img src="
|
|
8
|
+
<img src="https://files.catbox.moe/6zl5yw.jpg" width="400" alt="Elaina Bail Banner" style="border-radius: 15px; border: 2px solid #ff0000;" />
|
|
9
9
|
<br><br>
|
|
10
10
|
|
|
11
11
|
<p>
|
package/lib/Utils/resolveJid.js
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
|
+
ya udah aku pakai ini aja
|
|
2
|
+
|
|
1
3
|
"use strict";
|
|
2
4
|
|
|
3
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.resolveJid =
|
|
6
|
+
exports.resolveJid = resolveJid;
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
Resolve LID / raw id menjadi JID WhatsApp asli
|
|
10
|
+
@param {import('@rexxhayanasi/elaina-baileys').WASocket} conn
|
|
11
|
+
@param {any} m
|
|
12
|
+
@param {string|null} target
|
|
13
|
+
@returns {Promise<string|null>}
|
|
14
|
+
*/
|
|
7
15
|
|
|
8
|
-
async function resolveJid(
|
|
9
|
-
|
|
16
|
+
async function resolveJid(conn, m, target) {
|
|
17
|
+
let input =
|
|
18
|
+
target ||
|
|
19
|
+
(m.mentionedJid && m.mentionedJid[0]) ||
|
|
20
|
+
(m.quoted && m.quoted.sender) ||
|
|
21
|
+
m.sender;
|
|
10
22
|
|
|
11
|
-
|
|
12
|
-
target ||
|
|
13
|
-
(m.mentionedJid && m.mentionedJid[0]) ||
|
|
14
|
-
m.participant ||
|
|
15
|
-
(m.key && (m.key.participant || m.key.remoteJid));
|
|
23
|
+
if (!input) return null;
|
|
16
24
|
|
|
17
|
-
if (!input)
|
|
18
|
-
return null;
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
if (/@s.whatsapp.net$/.test(input))
|
|
27
|
+
return input;
|
|
22
28
|
|
|
23
|
-
const chat =
|
|
24
|
-
m.chat ||
|
|
25
|
-
(m.key && m.key.remoteJid);
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
if (!m.isGroup || !m.chat)
|
|
31
|
+
return null;
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
let meta;
|
|
34
|
+
try {
|
|
35
|
+
meta = await conn.groupMetadata(m.chat);
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
WABinary.areJidsSameUser(p.id, input) ||
|
|
35
|
-
(p.lid && p.lid === input)
|
|
36
|
-
);
|
|
40
|
+
if (!meta || !Array.isArray(meta.participants))
|
|
41
|
+
return null;
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
const participant = meta.participants.find(p =>
|
|
44
|
+
p.jid === input ||
|
|
45
|
+
p.id === input ||
|
|
46
|
+
p.lid === input ||
|
|
47
|
+
(typeof input === "string" && input.replace(/@lid$/, "") === p.lid?.replace(/@lid$/, ""))
|
|
48
|
+
);
|
|
40
49
|
|
|
41
|
-
|
|
50
|
+
if (participant && participant.jid)
|
|
51
|
+
return participant.jid;
|
|
52
|
+
|
|
53
|
+
return null;
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexxhayanasi/elaina-baileys",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Custom Baileys WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baileys",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
37
37
|
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
|
38
38
|
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
|
39
|
-
"prepack": "echo '
|
|
40
|
-
"prepare": "echo '
|
|
39
|
+
"prepack": "echo 'RexxHayanasi WhatsApp Library'",
|
|
40
|
+
"prepare": "echo 'RexxHayanasi WhatsApp Library'",
|
|
41
41
|
"preinstall": "node ./engine-requirements.js",
|
|
42
42
|
"release": "release-it",
|
|
43
43
|
"test": "jest"
|