Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case 'addcmd': {
- if (!isCreator && !isGroupAdmins) return reply("Hanya admin atau creator yang dapat menggunakan perintah ini!");
- if (!args[0] || !args[1]) return reply("Format salah! Gunakan: addcmd <command> <response>");
- const cmdName = args[0].startsWith('!') ? args[0]: `!${args[0]}`;
- const cmdResponse = args.slice(1).join(' ');
- if (customCommands.commands[cmdName]) {
- return reply(`Perintah "${cmdName}" sudah ada. Gunakan *editcmd* untuk mengeditnya.`);
- }
- customCommands.commands[cmdName] = cmdResponse;
- fs.writeFileSync('./database/customCommands.json', JSON.stringify(customCommands, null, 2));
- reply(`Perintah "${cmdName}" berhasil ditambahkan dengan respons: ${cmdResponse}`);
- }
- break;
- case 'editcmd': {
- if (!isCreator && !isGroupAdmins) return reply("Hanya admin atau creator yang dapat menggunakan perintah ini!");
- if (!args[0] || !args[1]) return reply("Format salah! Gunakan: editcmd <command> <new response>");
- const cmdName = args[0].startsWith('!') ? args[0]: `!${args[0]}`;
- if (!customCommands.commands[cmdName]) {
- return reply(`Perintah "${cmdName}" tidak ditemukan. Gunakan *addcmd* untuk membuatnya.`);
- }
- const newResponse = args.slice(1).join(' ');
- customCommands.commands[cmdName] = newResponse;
- fs.writeFileSync('./database/customCommands.json', JSON.stringify(customCommands, null, 2));
- reply(`Perintah "${cmdName}" berhasil diperbarui dengan respons baru: ${newResponse}`);
- }
- break;
- case 'delcmd': {
- if (!isCreator && !isGroupAdmins) return reply("Hanya admin atau creator yang dapat menggunakan perintah ini!");
- if (!args[0]) return reply("Format salah! Gunakan: delcmd <command>");
- const cmdName = args[0].startsWith('!') ? args[0]: `!${args[0]}`;
- if (!customCommands.commands[cmdName]) {
- return reply(`Perintah "${cmdName}" tidak ditemukan.`);
- }
- delete customCommands.commands[cmdName];
- fs.writeFileSync('./database/customCommands.json', JSON.stringify(customCommands, null, 2));
- reply(`Perintah "${cmdName}" berhasil dihapus.`);
- }
- break;
- case 'listcmd': {
- const cmdList = Object.keys(customCommands.commands).map(cmd => `• ${cmd}`).join('\n');
- reply(`Daftar Custom Commands:\n${cmdList || "Belum ada custom command."}`);
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement