vinzzsync-wacli 1.0.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/c.js +2 -0
- package/func.js +3263 -0
- package/index.js +2416 -0
- package/index2.js +3611 -0
- package/lib/sqlAuth.js +109 -0
- package/package.json +21 -0
- package/plugins/_loader.js +191 -0
- package/plugins/addplugins.js +93 -0
- package/plugins/backup.js +91 -0
- package/plugins/cekch.js +157 -0
- package/plugins/cekgb.js +105 -0
- package/plugins/clear.js +12 -0
- package/plugins/cmd.js +69 -0
- package/plugins/cmfil.js +110 -0
- package/plugins/cms.js +474 -0
- package/plugins/delplugins.js +57 -0
- package/plugins/dmsg.js +112 -0
- package/plugins/eval.js +175 -0
- package/plugins/evfil.js +86 -0
- package/plugins/exit.js +11 -0
- package/plugins/fadm.js +107 -0
- package/plugins/fakemsg.js +154 -0
- package/plugins/fakesize.js +204 -0
- package/plugins/fclick.js +111 -0
- package/plugins/fitnah.js +87 -0
- package/plugins/getfile.js +169 -0
- package/plugins/getplugins.js +71 -0
- package/plugins/getquoted.js +76 -0
- package/plugins/getusn.js +92 -0
- package/plugins/groups.js +62 -0
- package/plugins/help.js +19 -0
- package/plugins/ht.js +45 -0
- package/plugins/ht2.js +59 -0
- package/plugins/ht3.js +66 -0
- package/plugins/isbot.js +177 -0
- package/plugins/listplugins.js +103 -0
- package/plugins/me.js +95 -0
- package/plugins/minigames.js +144 -0
- package/plugins/ping.js +124 -0
- package/plugins/quoted.js +102 -0
- package/plugins/rvo.js +88 -0
- package/plugins/savefile.js +334 -0
- package/plugins/send.js +52 -0
- package/plugins/session.js +18 -0
- package/plugins/smsg.js +204 -0
- package/plugins/status.js +18 -0
- package/plugins/typing_troll.js +91 -0
- package/pp.jpg +0 -0
- package/vkazee-send-message.js +1238 -0
package/lib/sqlAuth.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom SQLite Auth Store untuk Baileys
|
|
3
|
+
* by Ryuu
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Database from "better-sqlite3";
|
|
7
|
+
import { proto, BufferJSON, initAuthCreds } from "@vkazee/baileys";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Membuat atau mengambil auth state dari SQLite
|
|
11
|
+
* @param {string} dbPath - Lokasi file SQLite (contoh: "./auth.db")
|
|
12
|
+
*/
|
|
13
|
+
export async function useSQLiteAuthState(dbPath = "./auth.db") {
|
|
14
|
+
const db = new Database(dbPath);
|
|
15
|
+
db.pragma("journal_mode = WAL");
|
|
16
|
+
|
|
17
|
+
db.prepare(`
|
|
18
|
+
CREATE TABLE IF NOT EXISTS baileys_state (
|
|
19
|
+
key TEXT PRIMARY KEY,
|
|
20
|
+
value BLOB
|
|
21
|
+
)
|
|
22
|
+
`).run();
|
|
23
|
+
|
|
24
|
+
const load = (key) => {
|
|
25
|
+
const row = db.prepare("SELECT value FROM baileys_state WHERE key = ?").get(key);
|
|
26
|
+
if (!row) return null;
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(row.value.toString(), BufferJSON.reviver);
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const save = (key, data) => {
|
|
35
|
+
const json = JSON.stringify(data, BufferJSON.replacer);
|
|
36
|
+
const buf = Buffer.from(json, "utf8");
|
|
37
|
+
db.prepare("REPLACE INTO baileys_state (key, value) VALUES (?, ?)").run(key, buf);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const creds = load("creds") || initAuthCreds();
|
|
41
|
+
|
|
42
|
+
const keys = {};
|
|
43
|
+
const categories = [
|
|
44
|
+
"pre-key",
|
|
45
|
+
"session",
|
|
46
|
+
"sender-key",
|
|
47
|
+
"app-state-sync-key",
|
|
48
|
+
"app-state-sync-version"
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
for (const category of categories) {
|
|
52
|
+
keys[category] = {};
|
|
53
|
+
const rows = db
|
|
54
|
+
.prepare("SELECT key, value FROM baileys_state WHERE key LIKE ?")
|
|
55
|
+
.all(`${category}:%`);
|
|
56
|
+
for (const row of rows) {
|
|
57
|
+
try {
|
|
58
|
+
keys[category][row.key.slice(category.length + 1)] = JSON.parse(row.value.toString());
|
|
59
|
+
} catch {}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function saveCreds() {
|
|
64
|
+
save("creds", creds);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const set = (category, id, value) => {
|
|
68
|
+
const key = `${category}:${id}`;
|
|
69
|
+
save(key, value);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const get = (category, id) => {
|
|
73
|
+
const key = `${category}:${id}`;
|
|
74
|
+
return load(key);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const del = (category, id) => {
|
|
78
|
+
const key = `${category}:${id}`;
|
|
79
|
+
db.prepare("DELETE FROM baileys_state WHERE key = ?").run(key);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
state: {
|
|
84
|
+
creds,
|
|
85
|
+
keys: {
|
|
86
|
+
get: async (type, ids) => {
|
|
87
|
+
const data = {};
|
|
88
|
+
for (const id of ids) {
|
|
89
|
+
const value = load(`${type}:${id}`);
|
|
90
|
+
if (value) data[id] = value;
|
|
91
|
+
}
|
|
92
|
+
return data;
|
|
93
|
+
},
|
|
94
|
+
set: async (data) => {
|
|
95
|
+
for (const category in data) {
|
|
96
|
+
for (const id in data[category]) {
|
|
97
|
+
const value = data[category][id];
|
|
98
|
+
save(`${category}:${id}`, value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
saveCreds: async () => save("creds", creds)
|
|
105
|
+
};
|
|
106
|
+
setInterval(async () => {
|
|
107
|
+
await save("creds", creds);
|
|
108
|
+
}, 30_000);
|
|
109
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vinzzsync-wacli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "WhatsApp CLI Controler",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "node index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@img/sharp-wasm32": "^0.35.4",
|
|
12
|
+
"@vkazee/baileys": "^7.0.0-rc.9-patch.4",
|
|
13
|
+
"archiver": "^8.0.0",
|
|
14
|
+
"baileys-mbuilder": "^0.0.1-security",
|
|
15
|
+
"better-sqlite3": "^13.0.3",
|
|
16
|
+
"fluent-ffmpeg": "^2.1.3",
|
|
17
|
+
"prompts": "^2.4.2",
|
|
18
|
+
"qrcode-terminal": "^0.12.0",
|
|
19
|
+
"sharp": "^0.35.4"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
|
|
5
|
+
const plugins = new Map();
|
|
6
|
+
|
|
7
|
+
const commandOrder = [
|
|
8
|
+
'help',
|
|
9
|
+
'send',
|
|
10
|
+
'me',
|
|
11
|
+
'profile',
|
|
12
|
+
'status',
|
|
13
|
+
'session',
|
|
14
|
+
'ping',
|
|
15
|
+
'reconnect',
|
|
16
|
+
'clear',
|
|
17
|
+
'groups',
|
|
18
|
+
'cms',
|
|
19
|
+
'dmsg',
|
|
20
|
+
'smsg',
|
|
21
|
+
'q',
|
|
22
|
+
'fr',
|
|
23
|
+
'fitnah',
|
|
24
|
+
'cekch',
|
|
25
|
+
'cekgb',
|
|
26
|
+
'fadm',
|
|
27
|
+
'evfil',
|
|
28
|
+
'cmfil',
|
|
29
|
+
'eval',
|
|
30
|
+
'cmd',
|
|
31
|
+
'exec',
|
|
32
|
+
'exit'
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
let pluginDir = path.resolve('./plugins');
|
|
36
|
+
let watcher = null;
|
|
37
|
+
let reloadTimer = null;
|
|
38
|
+
let loading = false;
|
|
39
|
+
|
|
40
|
+
async function loadPlugins({ info, errlog } = {}) {
|
|
41
|
+
if (loading) return plugins;
|
|
42
|
+
|
|
43
|
+
loading = true;
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
plugins.clear();
|
|
47
|
+
|
|
48
|
+
if (!fs.existsSync(pluginDir)) {
|
|
49
|
+
fs.mkdirSync(pluginDir, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const files = fs.readdirSync(pluginDir)
|
|
53
|
+
.filter(file => file.endsWith('.js'))
|
|
54
|
+
.filter(file => file !== '_loader.js')
|
|
55
|
+
.sort();
|
|
56
|
+
|
|
57
|
+
for (const file of files) {
|
|
58
|
+
const filePath = path.join(pluginDir, file);
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const url =
|
|
62
|
+
`${pathToFileURL(filePath).href}?v=${Date.now()}_${Math.random()}`;
|
|
63
|
+
|
|
64
|
+
const mod = await import(url);
|
|
65
|
+
const plugin = mod.default;
|
|
66
|
+
|
|
67
|
+
if (!plugin) continue;
|
|
68
|
+
if (!plugin.command || typeof plugin.run !== 'function') continue;
|
|
69
|
+
|
|
70
|
+
const commands = Array.isArray(plugin.command)
|
|
71
|
+
? plugin.command
|
|
72
|
+
: [plugin.command];
|
|
73
|
+
|
|
74
|
+
for (const command of commands) {
|
|
75
|
+
const name = String(command)
|
|
76
|
+
.trim()
|
|
77
|
+
.toLowerCase();
|
|
78
|
+
|
|
79
|
+
if (!name) continue;
|
|
80
|
+
|
|
81
|
+
plugins.set(name, plugin);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (typeof info === 'function') {
|
|
85
|
+
info(`Plugin loaded: ${file}`);
|
|
86
|
+
}
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (typeof errlog === 'function') {
|
|
89
|
+
errlog(`Plugin gagal dimuat: ${file}`, error);
|
|
90
|
+
} else {
|
|
91
|
+
console.error(`Plugin gagal dimuat: ${file}`, error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} finally {
|
|
96
|
+
loading = false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return plugins;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getPlugin(command) {
|
|
103
|
+
return plugins.get(
|
|
104
|
+
String(command || '').trim().toLowerCase()
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function getPlugins() {
|
|
109
|
+
return plugins;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getPluginCommands() {
|
|
113
|
+
const loaded = [...plugins.keys()];
|
|
114
|
+
|
|
115
|
+
const ordered = commandOrder.filter(
|
|
116
|
+
command => loaded.includes(command)
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const remaining = loaded.filter(
|
|
120
|
+
command => !commandOrder.includes(command)
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
return [...ordered, ...remaining];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function watchPlugins(options = {}) {
|
|
127
|
+
const {
|
|
128
|
+
info,
|
|
129
|
+
errlog
|
|
130
|
+
} = options;
|
|
131
|
+
|
|
132
|
+
if (watcher) {
|
|
133
|
+
watcher.close();
|
|
134
|
+
watcher = null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!fs.existsSync(pluginDir)) {
|
|
138
|
+
fs.mkdirSync(pluginDir, { recursive: true });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
watcher = fs.watch(
|
|
142
|
+
pluginDir,
|
|
143
|
+
{ persistent: true },
|
|
144
|
+
(eventType, filename) => {
|
|
145
|
+
if (!filename) return;
|
|
146
|
+
|
|
147
|
+
const file = filename.toString();
|
|
148
|
+
|
|
149
|
+
if (!file.endsWith('.js')) return;
|
|
150
|
+
if (file === '_loader.js') return;
|
|
151
|
+
|
|
152
|
+
clearTimeout(reloadTimer);
|
|
153
|
+
|
|
154
|
+
reloadTimer = setTimeout(async () => {
|
|
155
|
+
try {
|
|
156
|
+
await loadPlugins({
|
|
157
|
+
info: null,
|
|
158
|
+
errlog
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
if (typeof info === 'function') {
|
|
162
|
+
info(`Plugin registry diperbarui: ${file}`);
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
if (typeof errlog === 'function') {
|
|
166
|
+
errlog('Gagal reload plugin', error);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, 300);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
if (typeof info === 'function') {
|
|
174
|
+
info(`Plugin watcher aktif: ${pluginDir}`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return watcher;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function reloadPlugins(options = {}) {
|
|
181
|
+
return loadPlugins(options);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
loadPlugins,
|
|
186
|
+
reloadPlugins,
|
|
187
|
+
watchPlugins,
|
|
188
|
+
getPlugin,
|
|
189
|
+
getPlugins,
|
|
190
|
+
getPluginCommands
|
|
191
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
command: 'addplugins',
|
|
6
|
+
|
|
7
|
+
async run(ctx) {
|
|
8
|
+
const {
|
|
9
|
+
m,
|
|
10
|
+
args,
|
|
11
|
+
extractMessageText
|
|
12
|
+
} = ctx;
|
|
13
|
+
|
|
14
|
+
if (!m?.chat) return;
|
|
15
|
+
|
|
16
|
+
const name = String(args?.[0] || '')
|
|
17
|
+
.replace(/\.js$/i, '');
|
|
18
|
+
|
|
19
|
+
if (!name) {
|
|
20
|
+
await m.reply({
|
|
21
|
+
text: 'Gunakan: .addplugins <nama>'
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
|
|
27
|
+
await m.reply({
|
|
28
|
+
text: 'Nama plugin tidak valid.'
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (name === '_loader') {
|
|
34
|
+
await m.reply({
|
|
35
|
+
text: 'Plugin loader tidak boleh diubah.'
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!m.quoted) {
|
|
41
|
+
await m.reply({
|
|
42
|
+
text: 'Reply pesan yang berisi source plugin.'
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let source = '';
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
source =
|
|
51
|
+
extractMessageText?.(m.quoted.message) ||
|
|
52
|
+
m.quoted.text ||
|
|
53
|
+
m.quoted.body ||
|
|
54
|
+
'';
|
|
55
|
+
} catch {}
|
|
56
|
+
|
|
57
|
+
source = String(source).trim();
|
|
58
|
+
|
|
59
|
+
if (!source) {
|
|
60
|
+
await m.reply({
|
|
61
|
+
text: 'Quoted message tidak berisi source plugin.'
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const pluginDir = path.resolve('./plugins');
|
|
67
|
+
|
|
68
|
+
if (!fs.existsSync(pluginDir)) {
|
|
69
|
+
fs.mkdirSync(pluginDir, {
|
|
70
|
+
recursive: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const filePath = path.join(
|
|
75
|
+
pluginDir,
|
|
76
|
+
`${name}.js`
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const existed = fs.existsSync(filePath);
|
|
80
|
+
|
|
81
|
+
fs.writeFileSync(
|
|
82
|
+
filePath,
|
|
83
|
+
source,
|
|
84
|
+
'utf8'
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
await m.reply({
|
|
88
|
+
text: existed
|
|
89
|
+
? `Plugin diperbarui: ${name}.js`
|
|
90
|
+
: `Plugin ditambahkan: ${name}.js`
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
|
|
5
|
+
function runExec(command) {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
exec(command, {
|
|
8
|
+
cwd: process.cwd(),
|
|
9
|
+
maxBuffer: 1024 * 1024 * 20
|
|
10
|
+
}, (error, stdout, stderr) => {
|
|
11
|
+
if (error) {
|
|
12
|
+
reject(
|
|
13
|
+
new Error(
|
|
14
|
+
stderr?.trim() ||
|
|
15
|
+
stdout?.trim() ||
|
|
16
|
+
error.message
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
resolve(stdout);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
command: 'backup',
|
|
29
|
+
|
|
30
|
+
async run({ m, sock }) {
|
|
31
|
+
const backupDir = '/tmp';
|
|
32
|
+
|
|
33
|
+
const stamp = new Date()
|
|
34
|
+
.toISOString()
|
|
35
|
+
.replace(/[:.]/g, '-');
|
|
36
|
+
|
|
37
|
+
const fileName = `backup-${stamp}.zip`;
|
|
38
|
+
const zipPath = path.join(backupDir, fileName);
|
|
39
|
+
|
|
40
|
+
const command =
|
|
41
|
+
`zip -r -q ${JSON.stringify(zipPath)} . -x ${JSON.stringify('./node_modules/*')} ${JSON.stringify('./session/*')} ${JSON.stringify('./.git/*')}`;
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
await runExec(command);
|
|
45
|
+
|
|
46
|
+
if (!fs.existsSync(zipPath)) {
|
|
47
|
+
throw new Error('File backup tidak terbentuk');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const stat = fs.statSync(zipPath);
|
|
51
|
+
const size = (stat.size / 1024 / 1024).toFixed(2);
|
|
52
|
+
|
|
53
|
+
await sock.sendMessage(
|
|
54
|
+
m.chat,
|
|
55
|
+
{
|
|
56
|
+
document: {
|
|
57
|
+
url: zipPath
|
|
58
|
+
},
|
|
59
|
+
mimetype: 'application/zip',
|
|
60
|
+
fileName,
|
|
61
|
+
caption:
|
|
62
|
+
`BACKUP SELESAI\n\n` +
|
|
63
|
+
`File : ${fileName}\n` +
|
|
64
|
+
`Size : ${size} MB\n\n` +
|
|
65
|
+
`Exclude:\n` +
|
|
66
|
+
`- node_modules\n` +
|
|
67
|
+
`- session\n` +
|
|
68
|
+
`- .git`
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
quoted: global.v
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (fs.existsSync(zipPath)) {
|
|
76
|
+
fs.unlinkSync(zipPath);
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
const result =
|
|
80
|
+
`BACKUP GAGAL\n\n${error?.message || error}`;
|
|
81
|
+
|
|
82
|
+
if (m?.reply) {
|
|
83
|
+
await m.reply({
|
|
84
|
+
text: result
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
console.error(result);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
package/plugins/cekch.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
function out(m, ...args) {
|
|
2
|
+
if (m?.reply) {
|
|
3
|
+
const text = args.map(v => typeof v === "string" ? v : String(v)).join(" ");
|
|
4
|
+
void m.reply({ text });
|
|
5
|
+
} else {
|
|
6
|
+
console.log(...args);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
command: 'cekch',
|
|
12
|
+
|
|
13
|
+
async run({
|
|
14
|
+
m,
|
|
15
|
+
text,
|
|
16
|
+
sock
|
|
17
|
+
}) {
|
|
18
|
+
let input =
|
|
19
|
+
text.trim();
|
|
20
|
+
|
|
21
|
+
if (!input) {
|
|
22
|
+
out(m,
|
|
23
|
+
"Format:\n" +
|
|
24
|
+
"cekch <id channel / link channel>"
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
let info;
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
input.endsWith(
|
|
35
|
+
"@newsletter"
|
|
36
|
+
)
|
|
37
|
+
) {
|
|
38
|
+
info =
|
|
39
|
+
await sock.newsletterMetadata(
|
|
40
|
+
"jid",
|
|
41
|
+
input
|
|
42
|
+
);
|
|
43
|
+
} else {
|
|
44
|
+
input =
|
|
45
|
+
input.replace(
|
|
46
|
+
/\/+$/,
|
|
47
|
+
""
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
let inviteCode =
|
|
51
|
+
input.split("/").pop();
|
|
52
|
+
|
|
53
|
+
if (!inviteCode) {
|
|
54
|
+
out(m,
|
|
55
|
+
"[CEKCH] ID atau link tidak valid!"
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
info =
|
|
62
|
+
await sock.newsletterMetadata(
|
|
63
|
+
"invite",
|
|
64
|
+
inviteCode
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const meta =
|
|
69
|
+
info.thread_metadata || {};
|
|
70
|
+
|
|
71
|
+
const formatTime =
|
|
72
|
+
timestamp => {
|
|
73
|
+
if (!timestamp) {
|
|
74
|
+
return "-";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const date =
|
|
78
|
+
new Date(
|
|
79
|
+
Number(timestamp) * 1000
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return date.toLocaleString(
|
|
83
|
+
"id-ID",
|
|
84
|
+
{
|
|
85
|
+
timeZone:
|
|
86
|
+
"Asia/Jakarta",
|
|
87
|
+
dateStyle:
|
|
88
|
+
"full",
|
|
89
|
+
timeStyle:
|
|
90
|
+
"medium"
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const verification =
|
|
96
|
+
meta.verification ||
|
|
97
|
+
info.verification ||
|
|
98
|
+
"-";
|
|
99
|
+
|
|
100
|
+
out(m, `
|
|
101
|
+
╔════════════════════════════════════╗
|
|
102
|
+
║ CHANNEL INFO ║
|
|
103
|
+
╚════════════════════════════════════╝
|
|
104
|
+
|
|
105
|
+
📛 Nama
|
|
106
|
+
${meta.name?.text || "-"}
|
|
107
|
+
|
|
108
|
+
🆔 Channel ID
|
|
109
|
+
${info.id || "-"}
|
|
110
|
+
|
|
111
|
+
📌 Status
|
|
112
|
+
${info.state?.type || "-"}
|
|
113
|
+
|
|
114
|
+
✓ Verifikasi
|
|
115
|
+
${verification}
|
|
116
|
+
|
|
117
|
+
👥 Subscriber
|
|
118
|
+
${Number(
|
|
119
|
+
meta.subscribers_count || 0
|
|
120
|
+
).toLocaleString("id-ID")}
|
|
121
|
+
|
|
122
|
+
👤 Role Akun
|
|
123
|
+
${info.viewer_metadata?.role || "GUEST"}
|
|
124
|
+
|
|
125
|
+
🔔 Notifikasi
|
|
126
|
+
${info.viewer_metadata?.mute || "-"}
|
|
127
|
+
|
|
128
|
+
🔗 Invite Code
|
|
129
|
+
${meta.invite || "-"}
|
|
130
|
+
|
|
131
|
+
🌐 Link Channel
|
|
132
|
+
${meta.invite
|
|
133
|
+
? `https://whatsapp.com/channel/${meta.invite}`
|
|
134
|
+
: "-"}
|
|
135
|
+
|
|
136
|
+
🏷️ Handle
|
|
137
|
+
${meta.handle || "-"}
|
|
138
|
+
|
|
139
|
+
📅 Dibuat
|
|
140
|
+
${formatTime(meta.creation_time)}
|
|
141
|
+
|
|
142
|
+
🕒 Terakhir Diupdate
|
|
143
|
+
${formatTime(meta.update_time)}
|
|
144
|
+
|
|
145
|
+
📝 Deskripsi
|
|
146
|
+
${meta.description?.text || "-"}
|
|
147
|
+
|
|
148
|
+
══════════════════════════════════════
|
|
149
|
+
`);
|
|
150
|
+
} catch (err) {
|
|
151
|
+
out(m,
|
|
152
|
+
"[CEKCH] Gagal mengambil info channel:",
|
|
153
|
+
err.message || err
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|