Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(message.content.startsWith("/comadd")){
- var formated = null;
- if(message.channel.isPrivate) return bot.sendMessage(message, "You can't use this command on DM");
- var role = message.server.roles.get("name", "Bot-Commander");
- if(role != null || message.server.owner.id == message.author.id){
- if(message.author.hasRole(role) || message.server.owner.id == message.author.id) {
- var mes = message.content.split(" ").splice(1).join(" ");
- var pref = mes.split("|")[0].trim();
- var reply = mes.split("|")[1].trim();
- try{
- var formated = mes.split("|")[2].trmi();
- }catch(e){
- var formated = null;
- }
- if(customcom[message.server.id]){
- if (!customcom[message.server.id]["/" + pref]) {
- if(customcom[message.server.id]){
- customcom[message.server.id]["/" + pref] = { "reply": reply, "optionss": formated };
- bot.sendMessage(message, `the command /${pref} has been added to the list`)
- fs.writeFile("./customc.json", JSON.stringify(customcom))
- }else{
- customcom[message.server.id] = {};
- customcom[message.server.id]["/" + pref] = { "reply": reply, "optionss": formated };
- bot.sendMessage(message, `the command /${pref} has been added to the list`)
- fs.writeFile("./customc.json", JSON.stringify(customcom))
- }
- }else bot.sendMessage(message, "this command already exist");
- }
- }else bot.sendMessage(message, "You don't have the perm to use this command");
- }else bot.sendMessage(message, "You need to create the role `Bot-Commander` to get the full perm");
- }
- if(message.content.startsWith("/comdel")){
- var pref = message.content.split(" ").slice(1)[0];
- if(message.channel.isPrivate) return bot.sendMessage(message, "You can't use this command on DM")
- var role = message.server.roles.get("name", "Bot-Commander");
- if(role != null || message.server.owner.id == message.author.id){
- if(message.author.hasRole(role) || message.server.owner.id == message.author.id) {
- if(customcom[message.server.id]){
- if(customcom[message.server.id]["/" + pref]){
- delete customcom[message.server.id]["/" + pref];
- bot.sendMessage(message, pref + " has been deleted");
- fs.writeFile("./customc.json", JSON.stringify(customcom))
- }else bot.sendMessage(message, 'didn\' find the command ' + pref);
- }else bot.sendMessage(message, "there is no custom command for this server");
- }
- }else bot.sendMessage(message, "You need to create the role `Bot-Commander` to get the full perm");
- }
- if(message.content.startsWith("/")){
- if(message.channel.isPrivate) return;
- var pref = message.content;
- if(customcom[message.server.id]){
- if(customcom[message.server.id][pref]){
- if(customcom[message.server.id][pref].optionss != null){
- bot.sendMessage(message.author, customcom[message.server.id][pref].reply);
- }else{
- var mes = customcom[message.server.id][pref].reply.replace(/{user}/gi, message.author.mention())
- bot.sendMessage(message, mes)
- }
- }
- }else customcom[message.server.id] = {};
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement