-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCyber1pref.js
25 lines (21 loc) · 885 Bytes
/
Cyber1pref.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
import config from '../../config.cjs';
const setprefixCommand = 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 === 'setprefix') {
if (!isCreator) {
await Matrix.sendMessage(m.from, { text: "*📛 THIS IS AN OWNER COMMAND*" }, { quoted: m });
return;
}
if (text) {
config.PREFIX = text;
m.reply(`Prefix has been changed to '${text}'.`);
} else {
m.reply("Please specify a new prefix.");
}
}
};
export default setprefixCommand;