dibosockets 1.0.2 → 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/WAProto/WAProto.proto +5619 -5619
- package/lib/Api/Internet/growagarden.js +28 -28
- package/lib/Api/creator.json +13 -13
- package/lib/Api/downloader/tiktokdownload.js +132 -132
- package/lib/Api/index.js +38 -38
- package/lib/Api/nsfw/loli.js +79 -79
- package/lib/Api/stalker/githubstalk.js +46 -46
- package/lib/Api/stalker/stalkroblox.js +94 -94
- package/lib/Api/stalker/tiktokstalk.js +68 -68
- package/lib/Api/tools/ssweb.js +38 -38
- package/lib/Defaults/baileys-version.json +3 -3
- package/lib/Defaults/index.js +122 -122
- package/lib/Defaults/phonenumber_mcc.json +223 -223
- package/lib/Socket/RHandler.js +448 -448
- package/lib/Socket/business.js +266 -266
- package/lib/Socket/chats.js +1137 -1137
- package/lib/Socket/communities.js +441 -441
- package/lib/Socket/index.js +43 -43
- package/lib/Socket/messages-recv.js +1065 -1065
- package/lib/Socket/messages-send.js +881 -881
- package/lib/Socket/newsletter.js +286 -286
- package/lib/Socket/socket.js +666 -666
- package/lib/Store/make-in-memory-store.js +439 -439
- package/lib/Types/Newsletter.js +18 -18
- package/lib/Utils/async-iterable.js +41 -41
- package/lib/Utils/baileys-event-stream.js +63 -63
- package/lib/Utils/browser-utils.js +34 -34
- package/lib/Utils/event-buffer.js +518 -518
- package/lib/Utils/generics.js +431 -431
- package/lib/Utils/index.js +36 -36
- package/lib/Utils/message-retry-manager.js +127 -127
- package/lib/Utils/messages-media.js +926 -926
- package/lib/Utils/messages.js +1105 -1105
- package/lib/Utils/process-message.js +404 -404
- package/lib/Utils/resolveJid.js +52 -52
- package/lib/Utils/use-multi-file-auth-state.js +122 -122
- package/lib/Utils/validate-connection.js +228 -228
- package/lib/WABinary/jid-utils.js +85 -85
- package/lib/index.js +87 -74
- package/package.json +2 -2
|
@@ -1,28 +1,28 @@
|
|
|
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("@rexxhayanasi/elaina-baileys 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;
|
|
28
|
-
module.exports.default = growagarden;
|
|
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("@rexxhayanasi/elaina-baileys 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;
|
|
28
|
+
module.exports.default = growagarden;
|
package/lib/Api/creator.json
CHANGED
|
@@ -1,13 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,132 +1,132 @@
|
|
|
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 atau slide
|
|
94
|
-
if (result?.play || result?.hdplay) {
|
|
95
|
-
// Jika 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
|
-
// *** FIX EKSPOR ***
|
|
131
|
-
module.exports = tiktokdownload;
|
|
132
|
-
module.exports.default = tiktokdownload;
|
|
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 atau slide
|
|
94
|
+
if (result?.play || result?.hdplay) {
|
|
95
|
+
// Jika 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
|
+
// *** FIX EKSPOR ***
|
|
131
|
+
module.exports = tiktokdownload;
|
|
132
|
+
module.exports.default = tiktokdownload;
|
package/lib/Api/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.githubstalk =
|
|
7
|
-
exports.stalkroblox =
|
|
8
|
-
exports.ttstalk =
|
|
9
|
-
exports.growagarden =
|
|
10
|
-
exports.ttdl =
|
|
11
|
-
exports.loli =
|
|
12
|
-
exports.ssweb =
|
|
13
|
-
void 0;
|
|
14
|
-
|
|
15
|
-
// Bagian Stalker
|
|
16
|
-
const githubstalk_1 = __importDefault(require("./stalker/githubstalk"));
|
|
17
|
-
exports.githubstalk = githubstalk_1.default;
|
|
18
|
-
|
|
19
|
-
const stalkroblox_1 = __importDefault(require("./stalker/stalkroblox"));
|
|
20
|
-
exports.stalkroblox = stalkroblox_1.default;
|
|
21
|
-
|
|
22
|
-
const ttstalk_1 = __importDefault(require("./stalker/tiktokstalk"));
|
|
23
|
-
exports.ttstalk = ttstalk_1.default;
|
|
24
|
-
|
|
25
|
-
const growagarden_1 = __importDefault(require("./Internet/growagarden"));
|
|
26
|
-
exports.growagarden = growagarden_1.default;
|
|
27
|
-
|
|
28
|
-
// Bagian Downloader
|
|
29
|
-
const ttdl_1 = __importDefault(require("./downloader/tiktokdownload"));
|
|
30
|
-
exports.ttdl = ttdl_1.default;
|
|
31
|
-
|
|
32
|
-
// Bagian NSFW
|
|
33
|
-
const loli_1 = __importDefault(require("./nsfw/loli"));
|
|
34
|
-
exports.loli = loli_1.default;
|
|
35
|
-
|
|
36
|
-
// Bagian Tools
|
|
37
|
-
const ssweb_1 = __importDefault(require("./tools/ssweb"));
|
|
38
|
-
exports.ssweb = ssweb_1.default;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.githubstalk =
|
|
7
|
+
exports.stalkroblox =
|
|
8
|
+
exports.ttstalk =
|
|
9
|
+
exports.growagarden =
|
|
10
|
+
exports.ttdl =
|
|
11
|
+
exports.loli =
|
|
12
|
+
exports.ssweb =
|
|
13
|
+
void 0;
|
|
14
|
+
|
|
15
|
+
// Bagian Stalker
|
|
16
|
+
const githubstalk_1 = __importDefault(require("./stalker/githubstalk"));
|
|
17
|
+
exports.githubstalk = githubstalk_1.default;
|
|
18
|
+
|
|
19
|
+
const stalkroblox_1 = __importDefault(require("./stalker/stalkroblox"));
|
|
20
|
+
exports.stalkroblox = stalkroblox_1.default;
|
|
21
|
+
|
|
22
|
+
const ttstalk_1 = __importDefault(require("./stalker/tiktokstalk"));
|
|
23
|
+
exports.ttstalk = ttstalk_1.default;
|
|
24
|
+
|
|
25
|
+
const growagarden_1 = __importDefault(require("./Internet/growagarden"));
|
|
26
|
+
exports.growagarden = growagarden_1.default;
|
|
27
|
+
|
|
28
|
+
// Bagian Downloader
|
|
29
|
+
const ttdl_1 = __importDefault(require("./downloader/tiktokdownload"));
|
|
30
|
+
exports.ttdl = ttdl_1.default;
|
|
31
|
+
|
|
32
|
+
// Bagian NSFW
|
|
33
|
+
const loli_1 = __importDefault(require("./nsfw/loli"));
|
|
34
|
+
exports.loli = loli_1.default;
|
|
35
|
+
|
|
36
|
+
// Bagian Tools
|
|
37
|
+
const ssweb_1 = __importDefault(require("./tools/ssweb"));
|
|
38
|
+
exports.ssweb = ssweb_1.default;
|
package/lib/Api/nsfw/loli.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
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 { status: false, creator: CREATOR, images: [] };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const randomPost = posts[Math.floor(Math.random() * posts.length)];
|
|
30
|
-
const imageUrl = randomPost.file_url;
|
|
31
|
-
|
|
32
|
-
const imageProxyList = [
|
|
33
|
-
`https://corsproxy.io/?${encodeURIComponent(imageUrl)}`,
|
|
34
|
-
`https://api.codetabs.com/v1/proxy?quest=${encodeURIComponent(imageUrl)}`,
|
|
35
|
-
`https://cors-anywhere.herokuapp.com/${imageUrl}`
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const getImageBuffer = async (url) => {
|
|
39
|
-
const r = await fetch(url);
|
|
40
|
-
if (!r.ok) throw new Error();
|
|
41
|
-
const ab = await r.arrayBuffer();
|
|
42
|
-
return Buffer.from(ab);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const imageBuffer = await Promise.any(imageProxyList.map(getImageBuffer));
|
|
46
|
-
|
|
47
|
-
const formData = new FormData();
|
|
48
|
-
formData.append("reqtype", "fileupload");
|
|
49
|
-
formData.append("fileToUpload", new Blob([imageBuffer]), "image.jpg");
|
|
50
|
-
|
|
51
|
-
const uploadRes = await fetch("https://catbox.moe/user/api.php", {
|
|
52
|
-
method: "POST",
|
|
53
|
-
body: formData
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const catboxUrl = (await uploadRes.text()).trim();
|
|
57
|
-
|
|
58
|
-
if (!catboxUrl.startsWith("https://")) {
|
|
59
|
-
return { status: false, creator: CREATOR, images: [] };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
status: true,
|
|
64
|
-
images: [catboxUrl],
|
|
65
|
-
creator: CREATOR
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
} catch (err) {
|
|
69
|
-
return {
|
|
70
|
-
status: false,
|
|
71
|
-
creator: CREATOR,
|
|
72
|
-
images: [],
|
|
73
|
-
error: err.message
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
module.exports = loli;
|
|
79
|
-
module.exports.default = loli;
|
|
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 { status: false, creator: CREATOR, images: [] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const randomPost = posts[Math.floor(Math.random() * posts.length)];
|
|
30
|
+
const imageUrl = randomPost.file_url;
|
|
31
|
+
|
|
32
|
+
const imageProxyList = [
|
|
33
|
+
`https://corsproxy.io/?${encodeURIComponent(imageUrl)}`,
|
|
34
|
+
`https://api.codetabs.com/v1/proxy?quest=${encodeURIComponent(imageUrl)}`,
|
|
35
|
+
`https://cors-anywhere.herokuapp.com/${imageUrl}`
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const getImageBuffer = async (url) => {
|
|
39
|
+
const r = await fetch(url);
|
|
40
|
+
if (!r.ok) throw new Error();
|
|
41
|
+
const ab = await r.arrayBuffer();
|
|
42
|
+
return Buffer.from(ab);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const imageBuffer = await Promise.any(imageProxyList.map(getImageBuffer));
|
|
46
|
+
|
|
47
|
+
const formData = new FormData();
|
|
48
|
+
formData.append("reqtype", "fileupload");
|
|
49
|
+
formData.append("fileToUpload", new Blob([imageBuffer]), "image.jpg");
|
|
50
|
+
|
|
51
|
+
const uploadRes = await fetch("https://catbox.moe/user/api.php", {
|
|
52
|
+
method: "POST",
|
|
53
|
+
body: formData
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const catboxUrl = (await uploadRes.text()).trim();
|
|
57
|
+
|
|
58
|
+
if (!catboxUrl.startsWith("https://")) {
|
|
59
|
+
return { status: false, creator: CREATOR, images: [] };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
status: true,
|
|
64
|
+
images: [catboxUrl],
|
|
65
|
+
creator: CREATOR
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} catch (err) {
|
|
69
|
+
return {
|
|
70
|
+
status: false,
|
|
71
|
+
creator: CREATOR,
|
|
72
|
+
images: [],
|
|
73
|
+
error: err.message
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = loli;
|
|
79
|
+
module.exports.default = loli;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
const { creator: CREATOR } = require("../creator.json");
|
|
2
|
-
|
|
3
|
-
const githubstalk = async (user) => {
|
|
4
|
-
if (!user) {
|
|
5
|
-
return {
|
|
6
|
-
error: "Missing parameter 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": "Mozilla/5.0",
|
|
17
|
-
Accept: "application/vnd.github+json",
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (!response.ok) {
|
|
22
|
-
return {
|
|
23
|
-
error: response.status === 404 ? "User not found" : "GitHub API request failed",
|
|
24
|
-
status: response.status,
|
|
25
|
-
creator: CREATOR,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const data = await response.json();
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
success: true,
|
|
33
|
-
user: data,
|
|
34
|
-
creator: CREATOR,
|
|
35
|
-
};
|
|
36
|
-
} catch (err) {
|
|
37
|
-
return {
|
|
38
|
-
error: err.message || "GitHub API request failed",
|
|
39
|
-
status: 500,
|
|
40
|
-
creator: CREATOR,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
module.exports = githubstalk;
|
|
46
|
-
module.exports.default = githubstalk;
|
|
1
|
+
const { creator: CREATOR } = require("../creator.json");
|
|
2
|
+
|
|
3
|
+
const githubstalk = async (user) => {
|
|
4
|
+
if (!user) {
|
|
5
|
+
return {
|
|
6
|
+
error: "Missing parameter 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": "Mozilla/5.0",
|
|
17
|
+
Accept: "application/vnd.github+json",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
return {
|
|
23
|
+
error: response.status === 404 ? "User not found" : "GitHub API request failed",
|
|
24
|
+
status: response.status,
|
|
25
|
+
creator: CREATOR,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
success: true,
|
|
33
|
+
user: data,
|
|
34
|
+
creator: CREATOR,
|
|
35
|
+
};
|
|
36
|
+
} catch (err) {
|
|
37
|
+
return {
|
|
38
|
+
error: err.message || "GitHub API request failed",
|
|
39
|
+
status: 500,
|
|
40
|
+
creator: CREATOR,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = githubstalk;
|
|
46
|
+
module.exports.default = githubstalk;
|