@rexxhayanasi/elaina-baileys 1.0.3 → 1.0.4
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/Api/Internet/creator.json +13 -0
- package/lib/Api/Internet/growagarden.js +27 -0
- package/lib/Api/downloader/creator.json +13 -0
- package/lib/Api/downloader/tiktokdownload.js +130 -0
- package/lib/Api/index.js +7 -0
- package/lib/Api/nsfw/creator.json +13 -0
- package/lib/Api/nsfw/loli.js +86 -0
- package/lib/Api/stalker/creator.json +13 -0
- package/lib/Api/stalker/stalkroblox.js +93 -0
- package/lib/Api/tools/creator.json +13 -0
- package/lib/Api/tools/githubstalk.js +46 -0
- package/lib/Socket/chats.js +216 -46
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"creator": {
|
|
3
|
+
"name": "RexxHayanasi",
|
|
4
|
+
"username": "rexxhayanasi",
|
|
5
|
+
"github": "https://github.com/rexxhayanasi",
|
|
6
|
+
"instagram": "https://instagram.com/rexxhayanasi",
|
|
7
|
+
"website": "https://rexxhayanasi.dev",
|
|
8
|
+
"contact": {
|
|
9
|
+
"whatsapp": "https://wa.me/6285282530851",
|
|
10
|
+
"email": "rexxhayanasi@gmail.com"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { creator: CREATOR } = require("./creator.json");
|
|
2
|
+
|
|
3
|
+
const growagarden = async () => {
|
|
4
|
+
try {
|
|
5
|
+
const res = await fetch("https://gagstock.gleeze.com/grow-a-garden");
|
|
6
|
+
if (!res.ok) {
|
|
7
|
+
throw new Error("RClouds API Grow A Garden gagal mengambil data");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const json = await res.json();
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
creator: CREATOR,
|
|
14
|
+
status: json.status,
|
|
15
|
+
updated_at: json.updated_at,
|
|
16
|
+
data: json.data
|
|
17
|
+
};
|
|
18
|
+
} catch (err) {
|
|
19
|
+
return {
|
|
20
|
+
creator: CREATOR,
|
|
21
|
+
error: err.message,
|
|
22
|
+
status: 500
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = growagarden;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"creator": {
|
|
3
|
+
"name": "RexxHayanasi",
|
|
4
|
+
"username": "rexxhayanasi",
|
|
5
|
+
"github": "https://github.com/rexxhayanasi",
|
|
6
|
+
"instagram": "https://instagram.com/rexxhayanasi",
|
|
7
|
+
"website": "https://rexxhayanasi.dev",
|
|
8
|
+
"contact": {
|
|
9
|
+
"whatsapp": "https://wa.me/6285282530851",
|
|
10
|
+
"email": "rexxhayanasi@gmail.com"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const { creator: CREATOR } = require("../creator.json");
|
|
2
|
+
|
|
3
|
+
// === Proxy download file ===
|
|
4
|
+
async function proxyFile(fileUrl, filename, mimeType) {
|
|
5
|
+
const resp = await fetch(fileUrl);
|
|
6
|
+
const buffer = Buffer.from(await resp.arrayBuffer());
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
statusCode: 200,
|
|
10
|
+
headers: {
|
|
11
|
+
"Content-Type": mimeType,
|
|
12
|
+
"Content-Disposition": `attachment; filename="${filename}"`,
|
|
13
|
+
"Content-Length": buffer.length
|
|
14
|
+
},
|
|
15
|
+
body: buffer.toString("base64"),
|
|
16
|
+
isBase64Encoded: true
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// === Ambil image slide ===
|
|
21
|
+
async function fetchImages(url) {
|
|
22
|
+
try {
|
|
23
|
+
const apiUrl = `https://tikwm.com/api/?url=${encodeURIComponent(url)}`;
|
|
24
|
+
const res = await fetch(apiUrl).then(r => r.json());
|
|
25
|
+
|
|
26
|
+
if (res.code !== 0 || !res.data?.images || res.data.images.length === 0) {
|
|
27
|
+
return {
|
|
28
|
+
statusCode: 404,
|
|
29
|
+
headers: { "Content-Type": "application/json" },
|
|
30
|
+
body: JSON.stringify({
|
|
31
|
+
status: false,
|
|
32
|
+
message: "Gambar tidak ditemukan",
|
|
33
|
+
creator: CREATOR
|
|
34
|
+
}, null, 2)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
statusCode: 200,
|
|
40
|
+
headers: { "Content-Type": "application/json" },
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
status: true,
|
|
43
|
+
mode: "image",
|
|
44
|
+
creator: CREATOR,
|
|
45
|
+
images: res.data.images
|
|
46
|
+
}, null, 2)
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return {
|
|
51
|
+
statusCode: 500,
|
|
52
|
+
headers: { "Content-Type": "application/json" },
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
status: false,
|
|
55
|
+
message: "Terjadi kesalahan saat mengambil data",
|
|
56
|
+
creator: CREATOR,
|
|
57
|
+
error: e.message
|
|
58
|
+
}, null, 2)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function tiktokdownload(params = {}) {
|
|
64
|
+
try {
|
|
65
|
+
const { url, download } = params;
|
|
66
|
+
|
|
67
|
+
if (!url) {
|
|
68
|
+
return {
|
|
69
|
+
status: false,
|
|
70
|
+
message: "Masukkan parameter ?url=",
|
|
71
|
+
creator: CREATOR
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const apiRes = await fetch(
|
|
76
|
+
`https://www.tikwm.com/api?url=${encodeURIComponent(url)}&hd=1`,
|
|
77
|
+
{ method: "POST" }
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const json = await apiRes.json();
|
|
81
|
+
const result = json?.data;
|
|
82
|
+
|
|
83
|
+
// === Download langsung
|
|
84
|
+
if (download && result) {
|
|
85
|
+
if (download === "video" && (result.hdplay || result.play)) {
|
|
86
|
+
return await proxyFile(result.hdplay || result.play, "tiktok.mp4", "video/mp4");
|
|
87
|
+
}
|
|
88
|
+
if (download === "audio" && result.music) {
|
|
89
|
+
return await proxyFile(result.music, "tiktok.mp3", "audio/mpeg");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Video normal
|
|
94
|
+
if (result?.play || result?.hdplay) {
|
|
95
|
+
// Kalau slide
|
|
96
|
+
if (Array.isArray(result.images) && result.images.length > 0) {
|
|
97
|
+
return await fetchImages(url);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
status: true,
|
|
102
|
+
mode: "video",
|
|
103
|
+
creator: CREATOR,
|
|
104
|
+
author: {
|
|
105
|
+
unique_id: result.author.unique_id,
|
|
106
|
+
nickname: result.author.nickname
|
|
107
|
+
},
|
|
108
|
+
duration: result.duration,
|
|
109
|
+
cover: result.cover,
|
|
110
|
+
music: result.music,
|
|
111
|
+
play: result.play,
|
|
112
|
+
wmplay: result.wmplay,
|
|
113
|
+
hdplay: result.hdplay
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// fallback → slide
|
|
118
|
+
return await fetchImages(url);
|
|
119
|
+
|
|
120
|
+
} catch (err) {
|
|
121
|
+
return {
|
|
122
|
+
status: false,
|
|
123
|
+
message: "Server error",
|
|
124
|
+
creator: CREATOR,
|
|
125
|
+
error: String(err)
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = tiktokdownload;
|
package/lib/Api/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"creator": {
|
|
3
|
+
"name": "RexxHayanasi",
|
|
4
|
+
"username": "rexxhayanasi",
|
|
5
|
+
"github": "https://github.com/rexxhayanasi",
|
|
6
|
+
"instagram": "https://instagram.com/rexxhayanasi",
|
|
7
|
+
"website": "https://rexxhayanasi.dev",
|
|
8
|
+
"contact": {
|
|
9
|
+
"whatsapp": "https://wa.me/6285282530851",
|
|
10
|
+
"email": "rexxhayanasi@gmail.com"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const { creator: CREATOR } = require("../creator.json");
|
|
2
|
+
|
|
3
|
+
async function loli() {
|
|
4
|
+
try {
|
|
5
|
+
const randomPage = Math.floor(Math.random() * 200) + 1;
|
|
6
|
+
const konachanUrl = `https://konachan.com/post.json?tags=loli&limit=50&page=${randomPage}`;
|
|
7
|
+
|
|
8
|
+
const proxyList = [
|
|
9
|
+
`https://corsproxy.io/?${encodeURIComponent(konachanUrl)}`,
|
|
10
|
+
`https://api.codetabs.com/v1/proxy?quest=${encodeURIComponent(konachanUrl)}`,
|
|
11
|
+
`https://cors-anywhere.herokuapp.com/${konachanUrl}`
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const parsePosts = async (url) => {
|
|
15
|
+
const r = await fetch(url);
|
|
16
|
+
if (!r.ok) throw new Error();
|
|
17
|
+
if (url.includes("codetabs.com")) {
|
|
18
|
+
const t = await r.text();
|
|
19
|
+
return JSON.parse(t);
|
|
20
|
+
}
|
|
21
|
+
return await r.json();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const posts = await Promise.any(proxyList.map(parsePosts));
|
|
25
|
+
if (!posts || posts.length === 0) {
|
|
26
|
+
return {
|
|
27
|
+
status: false,
|
|
28
|
+
creator: CREATOR,
|
|
29
|
+
images: []
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const randomPost = posts[Math.floor(Math.random() * posts.length)];
|
|
34
|
+
const imageUrl = randomPost.file_url;
|
|
35
|
+
|
|
36
|
+
const imageProxyList = [
|
|
37
|
+
`https://corsproxy.io/?${encodeURIComponent(imageUrl)}`,
|
|
38
|
+
`https://api.codetabs.com/v1/proxy?quest=${encodeURIComponent(imageUrl)}`,
|
|
39
|
+
`https://cors-anywhere.herokuapp.com/${imageUrl}`
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const getImageBuffer = async (url) => {
|
|
43
|
+
const r = await fetch(url);
|
|
44
|
+
if (!r.ok) throw new Error();
|
|
45
|
+
const ab = await r.arrayBuffer();
|
|
46
|
+
return Buffer.from(ab);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const imageBuffer = await Promise.any(imageProxyList.map(getImageBuffer));
|
|
50
|
+
|
|
51
|
+
const formData = new FormData();
|
|
52
|
+
formData.append("reqtype", "fileupload");
|
|
53
|
+
formData.append("fileToUpload", new Blob([imageBuffer]), "image.jpg");
|
|
54
|
+
|
|
55
|
+
const uploadRes = await fetch("https://catbox.moe/user/api.php", {
|
|
56
|
+
method: "POST",
|
|
57
|
+
body: formData
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const catboxUrl = (await uploadRes.text()).trim();
|
|
61
|
+
|
|
62
|
+
if (!catboxUrl.startsWith("https://")) {
|
|
63
|
+
return {
|
|
64
|
+
status: false,
|
|
65
|
+
creator: CREATOR,
|
|
66
|
+
images: []
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
status: true,
|
|
72
|
+
creator: CREATOR,
|
|
73
|
+
images: [catboxUrl]
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} catch (err) {
|
|
77
|
+
return {
|
|
78
|
+
status: false,
|
|
79
|
+
creator: CREATOR,
|
|
80
|
+
images: [],
|
|
81
|
+
error: err.message
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = loli;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"creator": {
|
|
3
|
+
"name": "RexxHayanasi",
|
|
4
|
+
"username": "rexxhayanasi",
|
|
5
|
+
"github": "https://github.com/rexxhayanasi",
|
|
6
|
+
"instagram": "https://instagram.com/rexxhayanasi",
|
|
7
|
+
"website": "https://rexxhayanasi.dev",
|
|
8
|
+
"contact": {
|
|
9
|
+
"whatsapp": "https://wa.me/6285282530851",
|
|
10
|
+
"email": "rexxhayanasi@gmail.com"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const { creator: CREATOR } = require("./creator.json");
|
|
2
|
+
|
|
3
|
+
const postJson = async (url, body) => {
|
|
4
|
+
try {
|
|
5
|
+
const res = await fetch(url, {
|
|
6
|
+
method: "POST",
|
|
7
|
+
headers: { "Content-Type": "application/json" },
|
|
8
|
+
body: JSON.stringify(body)
|
|
9
|
+
});
|
|
10
|
+
if (!res.ok) return null;
|
|
11
|
+
return res.json();
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const safeFetchJson = async (url) => {
|
|
18
|
+
try {
|
|
19
|
+
const res = await fetch(url);
|
|
20
|
+
if (!res.ok) return null;
|
|
21
|
+
return res.json();
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const stalkroblox = async (username) => {
|
|
28
|
+
if (!username) {
|
|
29
|
+
return {
|
|
30
|
+
error: "Missing parameter ?username=",
|
|
31
|
+
creator: CREATOR
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const searchData = await postJson(
|
|
36
|
+
"https://users.roblox.com/v1/usernames/users",
|
|
37
|
+
{ usernames: [username], excludeBannedUsers: true }
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const userData = searchData?.data?.[0];
|
|
41
|
+
if (!userData) {
|
|
42
|
+
return {
|
|
43
|
+
error: `User "${username}" not found`,
|
|
44
|
+
creator: CREATOR
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const userId = userData.id;
|
|
49
|
+
|
|
50
|
+
const [
|
|
51
|
+
thumbnail,
|
|
52
|
+
info,
|
|
53
|
+
friends,
|
|
54
|
+
followers,
|
|
55
|
+
following,
|
|
56
|
+
groups,
|
|
57
|
+
badges
|
|
58
|
+
] = await Promise.all([
|
|
59
|
+
safeFetchJson(`https://thumbnails.roblox.com/v1/users/avatar?userIds=${userId}&size=420x420&format=Png&isCircular=false`),
|
|
60
|
+
safeFetchJson(`https://users.roblox.com/v1/users/${userId}`),
|
|
61
|
+
safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/friends/count`),
|
|
62
|
+
safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/followers/count`),
|
|
63
|
+
safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/followings/count`),
|
|
64
|
+
safeFetchJson(`https://groups.roblox.com/v1/users/${userId}/groups/roles`),
|
|
65
|
+
safeFetchJson(`https://badges.roblox.com/v1/users/${userId}/badges?limit=25&sortOrder=Asc`)
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
const data = {
|
|
69
|
+
username: userData.name,
|
|
70
|
+
displayName: userData.displayName,
|
|
71
|
+
userId,
|
|
72
|
+
profilePicUrl: thumbnail?.data?.[0]?.imageUrl || null,
|
|
73
|
+
description: info?.description || null,
|
|
74
|
+
joinDate: info?.created || null,
|
|
75
|
+
friendsCount: friends?.count ?? 0,
|
|
76
|
+
followersCount: followers?.count ?? 0,
|
|
77
|
+
followingCount: following?.count ?? 0,
|
|
78
|
+
groups: Array.isArray(groups?.data)
|
|
79
|
+
? groups.data.map(g => g.group?.name).filter(Boolean)
|
|
80
|
+
: [],
|
|
81
|
+
badges: Array.isArray(badges?.data)
|
|
82
|
+
? badges.data.map(b => b.name)
|
|
83
|
+
: []
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
success: true,
|
|
88
|
+
data,
|
|
89
|
+
creator: CREATOR
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
module.exports = stalkroblox;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"creator": {
|
|
3
|
+
"name": "RexxHayanasi",
|
|
4
|
+
"username": "rexxhayanasi",
|
|
5
|
+
"github": "https://github.com/rexxhayanasi",
|
|
6
|
+
"instagram": "https://instagram.com/rexxhayanasi",
|
|
7
|
+
"website": "https://rexxhayanasi.dev",
|
|
8
|
+
"contact": {
|
|
9
|
+
"whatsapp": "https://wa.me/6285282530851",
|
|
10
|
+
"email": "rexxhayanasi@gmail.com"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { creator: CREATOR } = require("./creator.json");
|
|
2
|
+
|
|
3
|
+
const githubstalk = async (user) => {
|
|
4
|
+
if (!user) {
|
|
5
|
+
return {
|
|
6
|
+
error: "Missing parameter ?user=<github_username>",
|
|
7
|
+
creator: CREATOR,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const url = `https://api.github.com/users/${user}`;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const response = await fetch(url, {
|
|
15
|
+
headers: {
|
|
16
|
+
"User-Agent":
|
|
17
|
+
"Mozilla/5.0",
|
|
18
|
+
Accept: "application/vnd.github+json",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
return {
|
|
24
|
+
error: response.status === 404 ? "User not found" : "GitHub API request failed",
|
|
25
|
+
status: response.status,
|
|
26
|
+
creator: CREATOR,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const data = await response.json();
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
user: data,
|
|
35
|
+
creator: CREATOR,
|
|
36
|
+
};
|
|
37
|
+
} catch (err) {
|
|
38
|
+
return {
|
|
39
|
+
error: err.message || "GitHub API request failed",
|
|
40
|
+
status: 500,
|
|
41
|
+
creator: CREATOR,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
module.exports = githubstalk;
|
package/lib/Socket/chats.js
CHANGED
|
@@ -177,6 +177,219 @@ const makeChatsSocket = (config) => {
|
|
|
177
177
|
return result.list;
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
|
+
const cekid = async (link) => {
|
|
181
|
+
try {
|
|
182
|
+
let url;
|
|
183
|
+
try {
|
|
184
|
+
url = new URL(link);
|
|
185
|
+
} catch {
|
|
186
|
+
return {
|
|
187
|
+
link,
|
|
188
|
+
jid: "-",
|
|
189
|
+
exists: false,
|
|
190
|
+
IsBanned: true,
|
|
191
|
+
metadata: "-",
|
|
192
|
+
error: "Invalid link format"
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const isChannel =
|
|
197
|
+
url.hostname === "whatsapp.com" &&
|
|
198
|
+
url.pathname.startsWith("/channel/");
|
|
199
|
+
|
|
200
|
+
if (!isChannel) {
|
|
201
|
+
return {
|
|
202
|
+
link,
|
|
203
|
+
jid: "-",
|
|
204
|
+
exists: false,
|
|
205
|
+
IsBanned: true,
|
|
206
|
+
metadata: "-",
|
|
207
|
+
error: "Link bukan link channel WhatsApp"
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const code = url.pathname.split("/channel/")[1]?.split("/")[0];
|
|
212
|
+
|
|
213
|
+
if (!code) {
|
|
214
|
+
return {
|
|
215
|
+
link,
|
|
216
|
+
jid: "-",
|
|
217
|
+
exists: false,
|
|
218
|
+
IsBanned: true,
|
|
219
|
+
metadata: "-",
|
|
220
|
+
error: "Invalid channel code"
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let data = null;
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
data = await conn.newsletterMetadata("invite", code);
|
|
228
|
+
} catch {
|
|
229
|
+
data = await conn.newsletterMetadata(code).catch(() => null);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (!data?.id) {
|
|
233
|
+
return {
|
|
234
|
+
link,
|
|
235
|
+
jid: "-",
|
|
236
|
+
exists: false,
|
|
237
|
+
IsBanned: true,
|
|
238
|
+
metadata: "-",
|
|
239
|
+
error: "Gagal mengambil metadata channel"
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
link,
|
|
245
|
+
jid: data.id,
|
|
246
|
+
exists: true,
|
|
247
|
+
IsBanned: false,
|
|
248
|
+
metadata: {
|
|
249
|
+
id: data.id || "-",
|
|
250
|
+
name: data.name || "-",
|
|
251
|
+
description: data.description || "-",
|
|
252
|
+
subscribers: data.subscribers || "-",
|
|
253
|
+
ownerJid: data.ownerJid || "-",
|
|
254
|
+
invite: data.invite || "-",
|
|
255
|
+
verification: data.verification || "-",
|
|
256
|
+
state: data.state || "-",
|
|
257
|
+
creation: data.creation || "-"
|
|
258
|
+
},
|
|
259
|
+
error: null
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
} catch (e) {
|
|
263
|
+
return {
|
|
264
|
+
link,
|
|
265
|
+
jid: "-",
|
|
266
|
+
exists: false,
|
|
267
|
+
IsBanned: true,
|
|
268
|
+
metadata: "-",
|
|
269
|
+
error: e.message
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const checkStatusWA = async (numberOrJid) => {
|
|
274
|
+
try {
|
|
275
|
+
const jid = numberOrJid.includes('@s.whatsapp.net')
|
|
276
|
+
? numberOrJid
|
|
277
|
+
: numberOrJid.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
|
|
278
|
+
|
|
279
|
+
const exists = await onWhatsApp(jid)
|
|
280
|
+
if (!exists || !exists[0]?.exists) {
|
|
281
|
+
return {
|
|
282
|
+
jid,
|
|
283
|
+
IsBanned: true,
|
|
284
|
+
Statusbio: "-",
|
|
285
|
+
setAt: "-",
|
|
286
|
+
businessProfile: {
|
|
287
|
+
wid: "-",
|
|
288
|
+
address: "-",
|
|
289
|
+
description: "-",
|
|
290
|
+
website: "-",
|
|
291
|
+
email: "-",
|
|
292
|
+
category: "-",
|
|
293
|
+
business_hours: "-"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const fetched = await fetchStatus(jid).catch(() => [])
|
|
299
|
+
const status = fetched?.[0]?.status?.status || "-"
|
|
300
|
+
const setAt = fetched?.[0]?.status?.setAt || "-"
|
|
301
|
+
|
|
302
|
+
const business = await getBusinessProfile(jid).catch(() => null)
|
|
303
|
+
|
|
304
|
+
const businessProfile = business ? {
|
|
305
|
+
wid: business.wid || "-",
|
|
306
|
+
address: business.address || "-",
|
|
307
|
+
description: business.description || "-",
|
|
308
|
+
website: business.website?.[0] || "-",
|
|
309
|
+
email: business.email || "-",
|
|
310
|
+
category: business.category || "-",
|
|
311
|
+
business_hours: business.business_hours || "-"
|
|
312
|
+
} : {
|
|
313
|
+
wid: "-",
|
|
314
|
+
address: "-",
|
|
315
|
+
description: "-",
|
|
316
|
+
website: "-",
|
|
317
|
+
email: "-",
|
|
318
|
+
category: "-",
|
|
319
|
+
business_hours: "-"
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return {
|
|
323
|
+
jid,
|
|
324
|
+
IsBanned: false,
|
|
325
|
+
Statusbio: status,
|
|
326
|
+
setAt,
|
|
327
|
+
businessProfile
|
|
328
|
+
}
|
|
329
|
+
} catch (e) {
|
|
330
|
+
return {
|
|
331
|
+
jid: numberOrJid,
|
|
332
|
+
IsBanned: true,
|
|
333
|
+
Statusbio: "-",
|
|
334
|
+
setAt: "-",
|
|
335
|
+
businessProfile: {
|
|
336
|
+
wid: "-",
|
|
337
|
+
address: "-",
|
|
338
|
+
description: "-",
|
|
339
|
+
website: "-",
|
|
340
|
+
email: "-",
|
|
341
|
+
category: "-",
|
|
342
|
+
business_hours: "-"
|
|
343
|
+
},
|
|
344
|
+
error: e.message
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const getBusinessProfile = async (jid) => {
|
|
349
|
+
const results = await query({
|
|
350
|
+
tag: 'iq',
|
|
351
|
+
attrs: {
|
|
352
|
+
to: 's.whatsapp.net',
|
|
353
|
+
xmlns: 'w:biz',
|
|
354
|
+
type: 'get'
|
|
355
|
+
},
|
|
356
|
+
content: [{
|
|
357
|
+
tag: 'business_profile',
|
|
358
|
+
attrs: { v: '244' },
|
|
359
|
+
content: [{
|
|
360
|
+
tag: 'profile',
|
|
361
|
+
attrs: { jid }
|
|
362
|
+
}]
|
|
363
|
+
}]
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
const profileNode = getBinaryNodeChild(results, 'business_profile')
|
|
367
|
+
const profiles = getBinaryNodeChild(profileNode, 'profile')
|
|
368
|
+
|
|
369
|
+
if (!profiles) return null
|
|
370
|
+
|
|
371
|
+
const address = getBinaryNodeChild(profiles, 'address')
|
|
372
|
+
const description = getBinaryNodeChild(profiles, 'description')
|
|
373
|
+
const website = getBinaryNodeChild(profiles, 'website')
|
|
374
|
+
const email = getBinaryNodeChild(profiles, 'email')
|
|
375
|
+
const category = getBinaryNodeChild(getBinaryNodeChild(profiles, 'categories'), 'category')
|
|
376
|
+
const businessHours = getBinaryNodeChild(profiles, 'business_hours')
|
|
377
|
+
const businessHoursConfig = businessHours ? getBinaryNodeChildren(businessHours, 'business_hours_config') : undefined
|
|
378
|
+
const websiteStr = website?.content?.toString()
|
|
379
|
+
|
|
380
|
+
return {
|
|
381
|
+
wid: profiles.attrs?.jid || "-",
|
|
382
|
+
address: address?.content?.toString() || "-",
|
|
383
|
+
description: description?.content?.toString() || "-",
|
|
384
|
+
website: websiteStr ? [websiteStr] : "-",
|
|
385
|
+
email: email?.content?.toString() || "-",
|
|
386
|
+
category: category?.content?.toString() || "-",
|
|
387
|
+
business_hours: businessHours ? {
|
|
388
|
+
timezone: businessHours.attrs?.timezone || "-",
|
|
389
|
+
business_config: businessHoursConfig?.map(v => v.attrs) || "-"
|
|
390
|
+
} : "-"
|
|
391
|
+
}
|
|
392
|
+
};
|
|
180
393
|
const fetchDisappearingDuration = async (...jids) => {
|
|
181
394
|
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
182
395
|
.withDisappearingModeProtocol();
|
|
@@ -284,51 +497,7 @@ const makeChatsSocket = (config) => {
|
|
|
284
497
|
]
|
|
285
498
|
});
|
|
286
499
|
};
|
|
287
|
-
|
|
288
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
289
|
-
const results = await query({
|
|
290
|
-
tag: 'iq',
|
|
291
|
-
attrs: {
|
|
292
|
-
to: 's.whatsapp.net',
|
|
293
|
-
xmlns: 'w:biz',
|
|
294
|
-
type: 'get'
|
|
295
|
-
},
|
|
296
|
-
content: [{
|
|
297
|
-
tag: 'business_profile',
|
|
298
|
-
attrs: { v: '244' },
|
|
299
|
-
content: [{
|
|
300
|
-
tag: 'profile',
|
|
301
|
-
attrs: { jid }
|
|
302
|
-
}]
|
|
303
|
-
}]
|
|
304
|
-
});
|
|
305
|
-
const profileNode = (0, WABinary_1.getBinaryNodeChild)(results, 'business_profile');
|
|
306
|
-
const profiles = (0, WABinary_1.getBinaryNodeChild)(profileNode, 'profile');
|
|
307
|
-
if (profiles) {
|
|
308
|
-
const address = (0, WABinary_1.getBinaryNodeChild)(profiles, 'address');
|
|
309
|
-
const description = (0, WABinary_1.getBinaryNodeChild)(profiles, 'description');
|
|
310
|
-
const website = (0, WABinary_1.getBinaryNodeChild)(profiles, 'website');
|
|
311
|
-
const email = (0, WABinary_1.getBinaryNodeChild)(profiles, 'email');
|
|
312
|
-
const category = (0, WABinary_1.getBinaryNodeChild)((0, WABinary_1.getBinaryNodeChild)(profiles, 'categories'), 'category');
|
|
313
|
-
const businessHours = (0, WABinary_1.getBinaryNodeChild)(profiles, 'business_hours');
|
|
314
|
-
const businessHoursConfig = businessHours
|
|
315
|
-
? (0, WABinary_1.getBinaryNodeChildren)(businessHours, 'business_hours_config')
|
|
316
|
-
: undefined;
|
|
317
|
-
const websiteStr = (_a = website === null || website === void 0 ? void 0 : website.content) === null || _a === void 0 ? void 0 : _a.toString();
|
|
318
|
-
return {
|
|
319
|
-
wid: (_b = profiles.attrs) === null || _b === void 0 ? void 0 : _b.jid,
|
|
320
|
-
address: (_c = address === null || address === void 0 ? void 0 : address.content) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
321
|
-
description: ((_d = description === null || description === void 0 ? void 0 : description.content) === null || _d === void 0 ? void 0 : _d.toString()) || '',
|
|
322
|
-
website: websiteStr ? [websiteStr] : [],
|
|
323
|
-
email: (_e = email === null || email === void 0 ? void 0 : email.content) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
324
|
-
category: (_f = category === null || category === void 0 ? void 0 : category.content) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
325
|
-
'business_hours': {
|
|
326
|
-
timezone: (_g = businessHours === null || businessHours === void 0 ? void 0 : businessHours.attrs) === null || _g === void 0 ? void 0 : _g.timezone,
|
|
327
|
-
'business_config': businessHoursConfig === null || businessHoursConfig === void 0 ? void 0 : businessHoursConfig.map(({ attrs }) => attrs)
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
};
|
|
500
|
+
|
|
332
501
|
const cleanDirtyBits = async (type, fromTimestamp) => {
|
|
333
502
|
logger.info({ fromTimestamp }, 'clean dirty bits ' + type);
|
|
334
503
|
await sendNode({
|
|
@@ -880,6 +1049,7 @@ const makeChatsSocket = (config) => {
|
|
|
880
1049
|
presenceSubscribe,
|
|
881
1050
|
profilePictureUrl,
|
|
882
1051
|
onWhatsApp,
|
|
1052
|
+
checkStatusWA,
|
|
883
1053
|
fetchBlocklist,
|
|
884
1054
|
fetchDisappearingDuration,
|
|
885
1055
|
fetchStatus,
|
|
@@ -912,4 +1082,4 @@ const makeChatsSocket = (config) => {
|
|
|
912
1082
|
star
|
|
913
1083
|
};
|
|
914
1084
|
};
|
|
915
|
-
exports.makeChatsSocket = makeChatsSocket;
|
|
1085
|
+
exports.makeChatsSocket = makeChatsSocket;
|
package/lib/index.js
CHANGED
|
@@ -52,5 +52,6 @@ __exportStar(require("./Defaults"), exports);
|
|
|
52
52
|
__exportStar(require("./WABinary"), exports);
|
|
53
53
|
__exportStar(require("./WAM"), exports);
|
|
54
54
|
__exportStar(require("./WAUSync"), exports);
|
|
55
|
+
__exportStar(require("./Api"), exports);
|
|
55
56
|
|
|
56
57
|
exports.default = Socket_1.default;
|