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
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
command: 'getusn',
|
|
3
|
+
|
|
4
|
+
async run({
|
|
5
|
+
m,
|
|
6
|
+
args,
|
|
7
|
+
sock,
|
|
8
|
+
normalizeJid
|
|
9
|
+
}) {
|
|
10
|
+
const target =
|
|
11
|
+
args[0]
|
|
12
|
+
? normalizeJid(args[0])
|
|
13
|
+
: m?.quoted?.sender || m?.sender;
|
|
14
|
+
|
|
15
|
+
if (!target) {
|
|
16
|
+
await m.reply({
|
|
17
|
+
text: 'Target tidak ditemukan.'
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const {
|
|
24
|
+
USyncQuery
|
|
25
|
+
} = await import('@vkazee/baileys');
|
|
26
|
+
|
|
27
|
+
const usyncQuery =
|
|
28
|
+
new USyncQuery();
|
|
29
|
+
|
|
30
|
+
usyncQuery.protocols.push({
|
|
31
|
+
name: 'username',
|
|
32
|
+
|
|
33
|
+
getQueryElement: () => ({
|
|
34
|
+
tag: 'username',
|
|
35
|
+
attrs: {}
|
|
36
|
+
}),
|
|
37
|
+
|
|
38
|
+
getUserElement: () => null,
|
|
39
|
+
|
|
40
|
+
parser: node => {
|
|
41
|
+
if (!node?.content) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (Buffer.isBuffer(node.content)) {
|
|
46
|
+
return node.content.toString();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (node.content?.data) {
|
|
50
|
+
return Buffer
|
|
51
|
+
.from(node.content.data)
|
|
52
|
+
.toString();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return node.content;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
usyncQuery.users.push({
|
|
60
|
+
id: target
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const result =
|
|
64
|
+
await sock.executeUSyncQuery(
|
|
65
|
+
usyncQuery
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const data =
|
|
69
|
+
result?.list?.[0];
|
|
70
|
+
|
|
71
|
+
const username =
|
|
72
|
+
data?.username || null;
|
|
73
|
+
|
|
74
|
+
await m.reply({
|
|
75
|
+
text:
|
|
76
|
+
`GET USERNAME\n\n` +
|
|
77
|
+
`ID : ${data?.id || target}\n` +
|
|
78
|
+
`Username : ${
|
|
79
|
+
username
|
|
80
|
+
? '@' + username
|
|
81
|
+
: 'Tidak ditemukan'
|
|
82
|
+
}`
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
} catch (error) {
|
|
86
|
+
await m.reply({
|
|
87
|
+
text:
|
|
88
|
+
`Gagal mengambil username:\n${error?.message || error}`
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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: 'groups',
|
|
12
|
+
|
|
13
|
+
async run({
|
|
14
|
+
m, sock }) {
|
|
15
|
+
try {
|
|
16
|
+
const groups =
|
|
17
|
+
await sock.groupFetchAllParticipating();
|
|
18
|
+
|
|
19
|
+
const list = Object.values(groups)
|
|
20
|
+
.sort((a, b) =>
|
|
21
|
+
String(a.subject || '').localeCompare(
|
|
22
|
+
String(b.subject || '')
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (!list.length) {
|
|
27
|
+
out(m,
|
|
28
|
+
'\x1b[33mTidak ada grup yang ditemukan.\x1b[0m'
|
|
29
|
+
);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
out(m, '');
|
|
34
|
+
out(m,
|
|
35
|
+
'\x1b[36m================= GROUP LIST =================\x1b[0m'
|
|
36
|
+
);
|
|
37
|
+
out(m, '');
|
|
38
|
+
|
|
39
|
+
list.forEach((group, index) => {
|
|
40
|
+
out(m,
|
|
41
|
+
`\x1b[33m[${index + 1}]\x1b[0m ${group.subject || '(Tanpa Nama)'}`
|
|
42
|
+
);
|
|
43
|
+
out(m, ` ID : ${group.id}`);
|
|
44
|
+
out(m, '');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
out(m,
|
|
48
|
+
`Total: ${list.length} grup`
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
out(m, '');
|
|
52
|
+
out(m,
|
|
53
|
+
'\x1b[36m===============================================\x1b[0m'
|
|
54
|
+
);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
out(m,
|
|
57
|
+
'\x1b[31m[GROUPlIST] Error:\x1b[0m',
|
|
58
|
+
e?.message || e
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
package/plugins/help.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
command: 'help',
|
|
3
|
+
|
|
4
|
+
async run({ m, getPluginCommands }) {
|
|
5
|
+
const commands = getPluginCommands();
|
|
6
|
+
|
|
7
|
+
const helpText = `╭─〔 COMMAND 〕
|
|
8
|
+
${commands.map(cmd => `│ .${cmd}`).join('\n')}
|
|
9
|
+
╰────────────────
|
|
10
|
+
|
|
11
|
+
Total: ${commands.length} command`;
|
|
12
|
+
|
|
13
|
+
if (m?.reply) {
|
|
14
|
+
await m.reply({ text: helpText });
|
|
15
|
+
} else {
|
|
16
|
+
console.log(helpText);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
package/plugins/ht.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
command: 'ht',
|
|
3
|
+
aliases: ['uwu'],
|
|
4
|
+
|
|
5
|
+
async run({
|
|
6
|
+
m,
|
|
7
|
+
args,
|
|
8
|
+
sock,
|
|
9
|
+
extractMessageText
|
|
10
|
+
}) {
|
|
11
|
+
if (!m?.isGroup) {
|
|
12
|
+
await m.reply({
|
|
13
|
+
text: '❌ Command ini hanya bisa digunakan di grup.'
|
|
14
|
+
});
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const metadata = await sock.groupMetadata(m.chat);
|
|
19
|
+
const mentionedJid = metadata.participants.map(a => a.id);
|
|
20
|
+
|
|
21
|
+
let text = args.join(' ').trim();
|
|
22
|
+
|
|
23
|
+
if (m?.quoted && !text) {
|
|
24
|
+
text = extractMessageText(m.quoted?.message) || '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!text) {
|
|
28
|
+
await m.reply({
|
|
29
|
+
text: 'Reply pesan atau gunakan: .ht <pesan>'
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
await sock.sendMessage(
|
|
35
|
+
m.chat,
|
|
36
|
+
{
|
|
37
|
+
text,
|
|
38
|
+
mentions: mentionedJid
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
quoted: global.v
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
};
|
package/plugins/ht2.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
command: 'ht2',
|
|
3
|
+
aliases: ['uwu2'],
|
|
4
|
+
|
|
5
|
+
async run({
|
|
6
|
+
m,
|
|
7
|
+
args,
|
|
8
|
+
sock,
|
|
9
|
+
extractMessageText
|
|
10
|
+
}) {
|
|
11
|
+
try {
|
|
12
|
+
if (!m?.isGroup) {
|
|
13
|
+
await m.reply({
|
|
14
|
+
text: '❌ Command ini hanya bisa digunakan di grup.'
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const metadata = await sock.groupMetadata(m.chat);
|
|
20
|
+
const mentionedJid = metadata.participants.map(a => a.id);
|
|
21
|
+
|
|
22
|
+
let text = args.join(' ').trim();
|
|
23
|
+
|
|
24
|
+
if (m?.quoted && !text) {
|
|
25
|
+
text = extractMessageText(m.quoted?.message) || '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!text) {
|
|
29
|
+
await m.reply({
|
|
30
|
+
text: 'Reply pesan atau gunakan: .ht2 <teks>'
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await sock.sendMessage(
|
|
36
|
+
m.chat,
|
|
37
|
+
{
|
|
38
|
+
text: `@${m.chat} ${text}`,
|
|
39
|
+
contextInfo: {
|
|
40
|
+
mentionedJid,
|
|
41
|
+
groupMentions: [
|
|
42
|
+
{
|
|
43
|
+
groupSubject: 'kata Mark Zuckerberg lu dipanggil',
|
|
44
|
+
groupJid: m.chat
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
quoted: global.v
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
await m.reply({
|
|
55
|
+
text: `❌ Error\nLogs error : ${e.message}`
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
package/plugins/ht3.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
command: 'ht3',
|
|
3
|
+
aliases: ['uwu3'],
|
|
4
|
+
|
|
5
|
+
async run({
|
|
6
|
+
m,
|
|
7
|
+
args,
|
|
8
|
+
sock,
|
|
9
|
+
extractMessageText
|
|
10
|
+
}) {
|
|
11
|
+
try {
|
|
12
|
+
if (!m?.isGroup) {
|
|
13
|
+
await m.reply({
|
|
14
|
+
text: '❌ Command ini hanya bisa digunakan di grup.'
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const groupSubject = args.join(' ').trim();
|
|
20
|
+
|
|
21
|
+
if (!groupSubject) {
|
|
22
|
+
await m.reply({
|
|
23
|
+
text: 'Gunakan: .ht3 <group subject>'
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const metadata = await sock.groupMetadata(m.chat);
|
|
29
|
+
const mentionedJid = metadata.participants.map(a => a.id);
|
|
30
|
+
|
|
31
|
+
let text = `@${m.chat}`;
|
|
32
|
+
|
|
33
|
+
if (m?.quoted) {
|
|
34
|
+
const quotedText =
|
|
35
|
+
extractMessageText(m.quoted?.message) || '';
|
|
36
|
+
|
|
37
|
+
if (quotedText) {
|
|
38
|
+
text += ` ${quotedText}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await sock.sendMessage(
|
|
43
|
+
m.chat,
|
|
44
|
+
{
|
|
45
|
+
text,
|
|
46
|
+
contextInfo: {
|
|
47
|
+
mentionedJid,
|
|
48
|
+
groupMentions: [
|
|
49
|
+
{
|
|
50
|
+
groupSubject,
|
|
51
|
+
groupJid: m.chat
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
quoted: global.v
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
await m.reply({
|
|
62
|
+
text: `❌ Error\nLogs error : ${e.message}`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
package/plugins/isbot.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
command: 'botc',
|
|
3
|
+
|
|
4
|
+
async run({
|
|
5
|
+
m,
|
|
6
|
+
extractMessageText
|
|
7
|
+
}) {
|
|
8
|
+
const quoted = m?.quoted;
|
|
9
|
+
|
|
10
|
+
if (!quoted) {
|
|
11
|
+
await m.reply({
|
|
12
|
+
text: '❌ Reply pesan yang mau dicek lalu gunakan .botc'
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const key = quoted?.key || {};
|
|
18
|
+
const message = quoted?.message || {};
|
|
19
|
+
|
|
20
|
+
const id = key.id || '';
|
|
21
|
+
const remoteJid = key.remoteJid || '';
|
|
22
|
+
const participant =
|
|
23
|
+
key.participant ||
|
|
24
|
+
key.senderPn ||
|
|
25
|
+
key.participantPn ||
|
|
26
|
+
'';
|
|
27
|
+
|
|
28
|
+
const sender =
|
|
29
|
+
participant ||
|
|
30
|
+
remoteJid ||
|
|
31
|
+
'unknown';
|
|
32
|
+
|
|
33
|
+
const messageType =
|
|
34
|
+
Object.keys(message)[0] || 'unknown';
|
|
35
|
+
|
|
36
|
+
const is3EB0 =
|
|
37
|
+
/^3EB0[A-F0-9]{18}$/i.test(id);
|
|
38
|
+
|
|
39
|
+
const has3EB0Prefix =
|
|
40
|
+
/^3EB0/i.test(id);
|
|
41
|
+
|
|
42
|
+
const validLength =
|
|
43
|
+
id.length === 22;
|
|
44
|
+
|
|
45
|
+
const isLid =
|
|
46
|
+
sender.endsWith('@lid') ||
|
|
47
|
+
remoteJid.endsWith('@lid');
|
|
48
|
+
|
|
49
|
+
const isPn =
|
|
50
|
+
sender.endsWith('@s.whatsapp.net');
|
|
51
|
+
|
|
52
|
+
const fromMe =
|
|
53
|
+
key.fromMe === true;
|
|
54
|
+
|
|
55
|
+
const hasParticipant =
|
|
56
|
+
Boolean(key.participant);
|
|
57
|
+
|
|
58
|
+
const standardMessage =
|
|
59
|
+
messageType === 'conversation' ||
|
|
60
|
+
messageType === 'extendedTextMessage';
|
|
61
|
+
|
|
62
|
+
let score = 0;
|
|
63
|
+
const reasons = [];
|
|
64
|
+
|
|
65
|
+
if (is3EB0) {
|
|
66
|
+
score += 7;
|
|
67
|
+
reasons.push(
|
|
68
|
+
'ID cocok dengan signature 3EB0 + 18 hex'
|
|
69
|
+
);
|
|
70
|
+
} else if (has3EB0Prefix) {
|
|
71
|
+
score += 4;
|
|
72
|
+
reasons.push(
|
|
73
|
+
'ID menggunakan prefix 3EB0'
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (validLength) {
|
|
78
|
+
score += 1;
|
|
79
|
+
reasons.push(
|
|
80
|
+
'ID memiliki panjang 22 karakter'
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (has3EB0Prefix) {
|
|
85
|
+
score += 2;
|
|
86
|
+
reasons.push(
|
|
87
|
+
'signature framework Baileys terdeteksi'
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (isLid) {
|
|
92
|
+
score += 1;
|
|
93
|
+
reasons.push(
|
|
94
|
+
'sender menggunakan LID'
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (hasParticipant) {
|
|
99
|
+
score += 1;
|
|
100
|
+
reasons.push(
|
|
101
|
+
'key participant tersedia'
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (standardMessage) {
|
|
106
|
+
score += 1;
|
|
107
|
+
reasons.push(
|
|
108
|
+
'message menggunakan tipe standard'
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (fromMe) {
|
|
113
|
+
reasons.push(
|
|
114
|
+
'pesan berasal dari akun sendiri'
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const isBot =
|
|
119
|
+
has3EB0Prefix;
|
|
120
|
+
|
|
121
|
+
const confidence =
|
|
122
|
+
is3EB0
|
|
123
|
+
? 'HIGH'
|
|
124
|
+
: has3EB0Prefix
|
|
125
|
+
? 'MEDIUM'
|
|
126
|
+
: 'LOW';
|
|
127
|
+
|
|
128
|
+
const content =
|
|
129
|
+
extractMessageText(quoted?.message) || '';
|
|
130
|
+
|
|
131
|
+
const idFormat =
|
|
132
|
+
is3EB0
|
|
133
|
+
? 'baileys (3EB0 + 18 hex)'
|
|
134
|
+
: has3EB0Prefix
|
|
135
|
+
? 'baileys (3EB0)'
|
|
136
|
+
: 'unknown';
|
|
137
|
+
|
|
138
|
+
const device =
|
|
139
|
+
isLid
|
|
140
|
+
? 'lid'
|
|
141
|
+
: isPn
|
|
142
|
+
? 'pn'
|
|
143
|
+
: 'unknown';
|
|
144
|
+
|
|
145
|
+
const report = `*ISBOT REPORT*
|
|
146
|
+
|
|
147
|
+
*TARGET:*
|
|
148
|
+
- Sender: ${sender}
|
|
149
|
+
- MessageType: ${messageType}
|
|
150
|
+
- MessageID: ${id}
|
|
151
|
+
- IDLength: ${id.length}
|
|
152
|
+
- Content: ${content}
|
|
153
|
+
|
|
154
|
+
*ANALYSIS:*
|
|
155
|
+
- IDFormat: ${idFormat}
|
|
156
|
+
- Framework: ${has3EB0Prefix ? 'baileys' : 'unknown'}
|
|
157
|
+
- Baileys: ${has3EB0Prefix ? 'yes' : 'no'}
|
|
158
|
+
- UseDevice: ${isLid ? 'yes' : 'no'}
|
|
159
|
+
- Device: ${device}
|
|
160
|
+
- FromMe: ${fromMe ? 'yes' : 'no'}
|
|
161
|
+
- Participant: ${hasParticipant ? 'yes' : 'no'}
|
|
162
|
+
- MsgType: ${standardMessage ? 'standard' : messageType}
|
|
163
|
+
- Score: +${score}
|
|
164
|
+
|
|
165
|
+
*RESULT:*
|
|
166
|
+
- isBot: ${isBot}
|
|
167
|
+
- Verdict: ${isBot ? 'BOT' : 'NOT BOT'}
|
|
168
|
+
- Confidence: ${confidence}
|
|
169
|
+
- Reason: ${reasons.length
|
|
170
|
+
? reasons.join(' — ')
|
|
171
|
+
: 'Tidak ditemukan signature Baileys'}`;
|
|
172
|
+
|
|
173
|
+
await m.reply({
|
|
174
|
+
text: report
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { AIRich } from '../func.js';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
command: 'listplugins',
|
|
7
|
+
|
|
8
|
+
async run(ctx) {
|
|
9
|
+
const {
|
|
10
|
+
m,
|
|
11
|
+
sock
|
|
12
|
+
} = ctx;
|
|
13
|
+
|
|
14
|
+
if (!m?.chat) return;
|
|
15
|
+
|
|
16
|
+
const pluginDir = path.resolve('./plugins');
|
|
17
|
+
|
|
18
|
+
if (!fs.existsSync(pluginDir)) {
|
|
19
|
+
await m.reply({
|
|
20
|
+
text: 'Folder plugins tidak ditemukan.'
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const files = fs.readdirSync(pluginDir)
|
|
26
|
+
.filter(file => file.endsWith('.js'))
|
|
27
|
+
.filter(file => file !== '_loader.js')
|
|
28
|
+
.sort();
|
|
29
|
+
|
|
30
|
+
const rows = [
|
|
31
|
+
['#', 'Plugin', 'Command', 'Size']
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < files.length; i++) {
|
|
35
|
+
const file = files[i];
|
|
36
|
+
const filePath = path.join(pluginDir, file);
|
|
37
|
+
const source = fs.readFileSync(filePath, 'utf8');
|
|
38
|
+
const stat = fs.statSync(filePath);
|
|
39
|
+
|
|
40
|
+
const match = source.match(
|
|
41
|
+
/command\s*:\s*(\[[\s\S]*?\]|['"`][^'"`]+['"`])/m
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
let commands = [];
|
|
45
|
+
|
|
46
|
+
if (match) {
|
|
47
|
+
const value = match[1];
|
|
48
|
+
|
|
49
|
+
if (value.startsWith('[')) {
|
|
50
|
+
commands = [
|
|
51
|
+
...value.matchAll(
|
|
52
|
+
/['"`]([^'"`]+)['"`]/g
|
|
53
|
+
)
|
|
54
|
+
].map(x => x[1]);
|
|
55
|
+
} else {
|
|
56
|
+
commands = [
|
|
57
|
+
value.slice(1, -1)
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
rows.push([
|
|
63
|
+
String(i + 1),
|
|
64
|
+
file,
|
|
65
|
+
commands.length
|
|
66
|
+
? commands.map(x => `.${x}`).join(' / ')
|
|
67
|
+
: '-',
|
|
68
|
+
formatSize(stat.size)
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const rich = new AIRich(sock)
|
|
73
|
+
.setTitle('PLUGIN LIST')
|
|
74
|
+
.addText(
|
|
75
|
+
`Menampilkan ${files.length} plugin yang terpasang.`,
|
|
76
|
+
{
|
|
77
|
+
id: 'info'
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
.addTable(
|
|
81
|
+
rows,
|
|
82
|
+
{
|
|
83
|
+
insertAt: 'info',
|
|
84
|
+
id: 'plugin_table'
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
.setFooter('Plugin Manager');
|
|
88
|
+
|
|
89
|
+
await rich.send(m.chat);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
function formatSize(bytes) {
|
|
94
|
+
if (bytes < 1024) {
|
|
95
|
+
return `${bytes} B`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (bytes < 1024 * 1024) {
|
|
99
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
103
|
+
}
|