-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCybermod.js
35 lines (30 loc) · 1.24 KB
/
Cybermod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import config from '../../config.cjs';
const modeCommand = async (m, Matrix) => {
const botNumber = await Matrix.decodeJid(Matrix.user.id);
const isCreator = [botNumber, config.OWNER_NUMBER + '@s.whatsapp.net'].includes(m.sender);
const prefix = config.PREFIX;
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : '';
const text = m.body.slice(prefix.length + cmd.length).trim();
if (cmd === 'mode') {
if (!isCreator) {
await Matrix.sendMessage(m.from, { text: "*📛 THIS IS AN OWNER COMMAND*" }, { quoted: m });
return;
}
if (['public', 'private'].includes(text)) {
if (text === 'public') {
Matrix.public = true;
config.MODE = "public";
m.reply('Mode has been changed to public.');
} else if (text === 'private') {
Matrix.public = false;
config.MODE = "private";
m.reply('Mode has been changed to private.');
} else {
m.reply("Usage:\n.Mode public/private");
}
} else {
m.reply("Invalid mode. Please use 'public' or 'private'.");
}
}
};
export default modeCommand;