Advertisement
Guest User

config.js

a guest
Nov 22nd, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const fse = require('fs-extra');
  3.  
  4. module.exports = {
  5.     name: "config",
  6.     description: "Configure the bot for your server.",
  7.     alaises: ['configs', 'settings', 'guildsettings', 'dashboard'],
  8.     usage: '<setting> <arguments>',
  9.     category: 'manager',
  10.     guildOnly: true,
  11.     example: 'No example.',
  12.  
  13.     code(client, message, args) {
  14.         if (!message.member.hasPermission('ADMINISTRATOR')) return message.reply(`You are not permitted to configurate the bot for this server as you are not an administrator.`);
  15.         fse.readJson(`./databases/${message.guild.id}.json`, (err, db) => {
  16.             if (err) return message.reply(`Error, ${err}`).then(console.error(err));
  17.        
  18.  
  19.         let setting = args[0];
  20.         if (!setting) {
  21.             const settingsList = new Discord.RichEmbed()
  22.             .setColor(process.env.COLOR)
  23.             .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  24.             .setTitle(`List of Settings!`)
  25.             .addField(`Moderation`, `mod-logs\nmod-logs-channel\naction-logs\naction-logs-channel\napp-logs\napp-logs-channel`, true)
  26.             .addField(`Levels`, `level-rewards\nxp-rate\nlevel-msgs\nlevel-channel\nlevel-message`, true)
  27.             .addField(`Supporter`, `premium`, true)
  28.             .setFooter(`${message.author.tag}`, message.author.avatarURL)
  29.             .setTimestamp()
  30.  
  31.             return message.channel.send(settingsList)
  32.             .catch(error => {
  33.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  34.                 .then(() => {
  35.                     message.author.send(settingsList);
  36.                 })
  37.                 .catch(error => error);
  38.                 error;
  39.             });
  40.         }
  41.  
  42.         let arguments = args.slice(1).join(' ');
  43.        
  44.         let On = ['true', 'on', 'yes', 'enable'];
  45.         let Off = ['false', 'off', 'no', 'disable'];
  46.  
  47.         if (setting.toLowerCase() === 'mod-logs') {
  48.             if (!arguments) {
  49.                 const argsList = new Discord.RichEmbed()
  50.                 .setColor(process.env.COLOR)
  51.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  52.                 .setTitle(`List of Arguments!`)
  53.                 .setDescription(`Right now, Mod Logs is set to ${db.server.configs.punishLogs}`)
  54.                 .addField(`On`, On.join('\n '), true)
  55.                 .addField(`Off`, Off.join('\n '), true)
  56.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  57.                 .setTimestamp()
  58.  
  59.                 return message.channel.send(argsList)
  60.             .catch(error => {
  61.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  62.                 .then(() => {
  63.                     message.author.send(argsList);
  64.                 })
  65.                 .catch(error => error);
  66.                 error;
  67.             });
  68.  
  69.             }
  70.  
  71.             if (On.includes(arguments.toLowerCase())) {
  72.                 db.server.configs.punishLogs = 'true';
  73.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  74.                     .then(() => {
  75.                         const successEmbed = new Discord.RichEmbed()
  76.                         .setColor(process.env.COLOR)
  77.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  78.                         .setTitle(`Successfully Changed Configurations!`)
  79.                         .setDescription(`${setting} has now been set to ${arguments}`)
  80.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  81.                         .setTimestamp()
  82.  
  83.                         return message.channel.send(successEmbed)
  84.                         .catch(error => {
  85.                             message.author.send(successEmbed)
  86.                             .catch(error => error);
  87.                             error;
  88.                         });
  89.                     });
  90.             } else if (Off.includes(arguments.toLowerCase())) {
  91.                 db.server.configs.punishLogs = 'false';
  92.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  93.                     .then(() => {
  94.                         const successEmbed = new Discord.RichEmbed()
  95.                         .setColor(process.env.COLOR)
  96.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  97.                         .setTitle(`Successfully Changed Configurations!`)
  98.                         .setDescription(`${setting} has now been set to ${arguments}`)
  99.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  100.                         .setTimestamp()
  101.  
  102.                         return message.channel.send(successEmbed)
  103.                         .catch(error => {
  104.                             message.author.send(successEmbed)
  105.                             .catch(error => error);
  106.                             error;
  107.                         });
  108.                     });
  109.             } else {
  110.                 const argsList = new Discord.RichEmbed()
  111.                 .setColor(process.env.COLOR)
  112.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  113.                 .setTitle(`List of Arguments!`)
  114.                 .addField(`On`, On.join('\n '), true)
  115.                 .addField(`Off`, Off.join('\n '), true)
  116.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  117.                 .setTimestamp()
  118.  
  119.                 return message.channel.send(argsList)
  120.                 .catch(error => {
  121.                     message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  122.                     .then(() => {
  123.                         message.author.send(argsList);
  124.                     })
  125.                     .catch(error => error);
  126.                     error;
  127.                 });
  128.             }
  129.  
  130.         } else if (setting.toLowerCase() === 'mod-logs-channel') {
  131.             if (!arguments) {
  132.                 const argsList = new Discord.RichEmbed()
  133.                 .setColor(process.env.COLOR)
  134.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  135.                 .setTitle(`List of Arguments!`)
  136.                 .setDescription(`ChannelID`)
  137.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  138.                 .setTimestamp()
  139.  
  140.                 return message.channel.send(argsList)
  141.             .catch(error => {
  142.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  143.                 .then(() => {
  144.                     message.author.send(argsList);
  145.                 })
  146.                 .catch(error => error);
  147.                 error;
  148.             });
  149.  
  150.             }
  151.            
  152.                 arguments = args.slice(1).join(' ');
  153.                 if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
  154.                     let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
  155.                     db.server.configs.modLogsChannel = c.id;
  156.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  157.                     .then(() => {
  158.                         const successEmbed = new Discord.RichEmbed()
  159.                         .setColor(process.env.COLOR)
  160.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  161.                         .setTitle(`Successfully Changed Configurations!`)
  162.                         .setDescription(`${setting} has now been set to ${arguments}`)
  163.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  164.                         .setTimestamp()
  165.  
  166.                         return message.channel.send(successEmbed)
  167.                         .catch(error => {
  168.                             message.author.send(successEmbed)
  169.                             .catch(error => error);
  170.                             error;
  171.                         });
  172.                     });
  173.             } else if (message.guild.channels.get(arguments)) {
  174.                     db.server.configs.modLogsChannel = arguments;
  175.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  176.                     .then(() => {
  177.                         const successEmbed = new Discord.RichEmbed()
  178.                         .setColor(process.env.COLOR)
  179.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  180.                         .setTitle(`Successfully Changed Configurations!`)
  181.                         .setDescription(`${setting} has now been set to ${arguments}`)
  182.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  183.                         .setTimestamp()
  184.  
  185.                         return message.channel.send(successEmbed)
  186.                         .catch(error => {
  187.                             message.author.send(successEmbed)
  188.                             .catch(error => error);
  189.                             error;
  190.                         });
  191.                     });
  192.                 } else {
  193.                     return message.reply(`I was unable to find the channel \`${arguments}\`.`)
  194.                     .catch(error => {
  195.                         message.author.send(`I was unable to find the channel \`${arguments}\`.`)
  196.                         .catch(error => error);
  197.                         error;
  198.                     });
  199.                 }
  200.  
  201.         } else if (setting.toLowerCase() === 'action-logs') {
  202.             if (!arguments) {
  203.                 const argsList = new Discord.RichEmbed()
  204.                 .setColor(process.env.COLOR)
  205.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  206.                 .setTitle(`List of Arguments!`)
  207.                 .addField(`On`, On.join('\n '), true)
  208.                 .addField(`Off`, Off.join('\n '), true)
  209.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  210.                 .setTimestamp()
  211.  
  212.                 return message.channel.send(argsList)
  213.             .catch(error => {
  214.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  215.                 .then(() => {
  216.                     message.author.send(argsList);
  217.                 })
  218.                 .catch(error => error);
  219.                 error;
  220.             });
  221.  
  222.             }
  223.  
  224.             if (On.includes(arguments.toLowerCase())) {
  225.                 db.server.configs.actionLogs = 'true';
  226.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  227.                     .then(() => {
  228.                         const successEmbed = new Discord.RichEmbed()
  229.                         .setColor(process.env.COLOR)
  230.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  231.                         .setTitle(`Successfully Changed Configurations!`)
  232.                         .setDescription(`${setting} has now been set to ${arguments}`)
  233.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  234.                         .setTimestamp()
  235.  
  236.                         return message.channel.send(successEmbed)
  237.                         .catch(error => {
  238.                             message.author.send(successEmbed)
  239.                             .catch(error => error);
  240.                             error;
  241.                         });
  242.                     });
  243.             } else if (Off.includes(arguments.toLowerCase())) {
  244.                 db.server.configs.actionLogs = 'false';
  245.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  246.                     .then(() => {
  247.                         const successEmbed = new Discord.RichEmbed()
  248.                         .setColor(process.env.COLOR)
  249.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  250.                         .setTitle(`Successfully Changed Configurations!`)
  251.                         .setDescription(`${setting} has now been set to ${arguments}`)
  252.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  253.                         .setTimestamp()
  254.  
  255.                         return message.channel.send(successEmbed)
  256.                         .catch(error => {
  257.                             message.author.send(successEmbed)
  258.                             .catch(error => error);
  259.                             error;
  260.                         });
  261.                     });
  262.             } else {
  263.                 const argsList = new Discord.RichEmbed()
  264.                 .setColor(process.env.COLOR)
  265.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  266.                 .setTitle(`List of Arguments!`)
  267.                 .addField(`On`, On.join('\n '), true)
  268.                 .addField(`Off`, Off.join('\n '), true)
  269.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  270.                 .setTimestamp()
  271.  
  272.                 return message.channel.send(argsList)
  273.                 .catch(error => {
  274.                     message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  275.                     .then(() => {
  276.                         message.author.send(argsList);
  277.                     })
  278.                     .catch(error => error);
  279.                     error;
  280.                 });
  281.             }
  282.  
  283.         } else if (setting.toLowerCase() === 'action-logs-channel') {
  284.             if (!arguments) {
  285.                 const argsList = new Discord.RichEmbed()
  286.                 .setColor(process.env.COLOR)
  287.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  288.                 .setTitle(`List of Arguments!`)
  289.                 .setDescription(`ChannelID`)
  290.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  291.                 .setTimestamp()
  292.  
  293.                 return message.channel.send(argsList)
  294.             .catch(error => {
  295.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  296.                 .then(() => {
  297.                     message.author.send(argsList);
  298.                 })
  299.                 .catch(error => error);
  300.                 error;
  301.             });
  302.  
  303.             }
  304.  
  305.                 arguments = args.slice(1).join(' ');
  306.                 if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
  307.                     let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
  308.                     db.server.configs.actionLogsChannel = c.id;
  309.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  310.                     .then(() => {
  311.                         const successEmbed = new Discord.RichEmbed()
  312.                         .setColor(process.env.COLOR)
  313.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  314.                         .setTitle(`Successfully Changed Configurations!`)
  315.                         .setDescription(`${setting} has now been set to ${arguments}`)
  316.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  317.                         .setTimestamp()
  318.  
  319.                         return message.channel.send(successEmbed)
  320.                         .catch(error => {
  321.                             message.author.send(successEmbed)
  322.                             .catch(error => error);
  323.                             error;
  324.                         });
  325.                     });
  326.             } else if (message.guild.channels.get(arguments)) {
  327.                     db.server.configs.actionLogsChannel = arguments;
  328.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  329.                     .then(() => {
  330.                         const successEmbed = new Discord.RichEmbed()
  331.                         .setColor(process.env.COLOR)
  332.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  333.                         .setTitle(`Successfully Changed Configurations!`)
  334.                         .setDescription(`${setting} has now been set to ${arguments}`)
  335.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  336.                         .setTimestamp()
  337.  
  338.                         return message.channel.send(successEmbed)
  339.                         .catch(error => {
  340.                             message.author.send(successEmbed)
  341.                             .catch(error => error);
  342.                             error;
  343.                         });
  344.                     });
  345.                 } else {
  346.                     return message.reply(`I was unable to find the channel \`${arguments}\`.`)
  347.                     .catch(error => {
  348.                         message.author.send(`I was unable to find the channel \`${arguments}\`.`)
  349.                         .catch(error => error);
  350.                         error;
  351.                     });
  352.                 }
  353.  
  354.         } else if (setting.toLowerCase() === 'app-logs') {
  355.             if (!arguments) {
  356.                 const argsList = new Discord.RichEmbed()
  357.                 .setColor(process.env.COLOR)
  358.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  359.                 .setTitle(`List of Arguments!`)
  360.                 .addField(`On`, On.join('\n '), true)
  361.                 .addField(`Off`, Off.join('\n '), true)
  362.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  363.                 .setTimestamp()
  364.  
  365.                 return message.channel.send(argsList)
  366.             .catch(error => {
  367.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  368.                 .then(() => {
  369.                     message.author.send(argsList);
  370.                 })
  371.                 .catch(error => error);
  372.                 error;
  373.             });
  374.  
  375.             }
  376.  
  377.             if (On.includes(arguments.toLowerCase())) {
  378.                 db.server.configs.appLogs = 'true';
  379.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  380.                     .then(() => {
  381.                         const successEmbed = new Discord.RichEmbed()
  382.                         .setColor(process.env.COLOR)
  383.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  384.                         .setTitle(`Successfully Changed Configurations!`)
  385.                         .setDescription(`${setting} has now been set to ${arguments}`)
  386.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  387.                         .setTimestamp()
  388.  
  389.                         return message.channel.send(successEmbed)
  390.                         .catch(error => {
  391.                             message.author.send(successEmbed)
  392.                             .catch(error => error);
  393.                             error;
  394.                         });
  395.                     });
  396.             } else if (Off.includes(arguments.toLowerCase())) {
  397.                 db.server.configs.appLogs = 'false';
  398.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  399.                     .then(() => {
  400.                         const successEmbed = new Discord.RichEmbed()
  401.                         .setColor(process.env.COLOR)
  402.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  403.                         .setTitle(`Successfully Changed Configurations!`)
  404.                         .setDescription(`${setting} has now been set to ${arguments}`)
  405.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  406.                         .setTimestamp()
  407.  
  408.                         return message.channel.send(successEmbed)
  409.                         .catch(error => {
  410.                             message.author.send(successEmbed)
  411.                             .catch(error => error);
  412.                             error;
  413.                         });
  414.                     });
  415.             } else {
  416.                 const argsList = new Discord.RichEmbed()
  417.                 .setColor(process.env.COLOR)
  418.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  419.                 .setTitle(`List of Arguments!`)
  420.                 .addField(`On`, On.join('\n '), true)
  421.                 .addField(`Off`, Off.join('\n '), true)
  422.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  423.                 .setTimestamp()
  424.  
  425.                 return message.channel.send(argsList)
  426.                 .catch(error => {
  427.                     message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  428.                     .then(() => {
  429.                         message.author.send(argsList);
  430.                     })
  431.                     .catch(error => error);
  432.                     error;
  433.                 });
  434.             }
  435.  
  436.            
  437.         } else if (setting.toLowerCase() === 'app-logs-channel') {
  438.             if (!arguments) {
  439.                 const argsList = new Discord.RichEmbed()
  440.                 .setColor(process.env.COLOR)
  441.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  442.                 .setTitle(`List of Arguments!`)
  443.                 .setDescription(`ChannelID`)
  444.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  445.                 .setTimestamp()
  446.  
  447.                 return message.channel.send(argsList)
  448.             .catch(error => {
  449.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  450.                 .then(() => {
  451.                     message.author.send(argsList);
  452.                 })
  453.                 .catch(error => error);
  454.                 error;
  455.             });
  456.  
  457.             }
  458.  
  459.                 arguments = args.slice(1).join(' ');
  460.                 if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
  461.                     let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
  462.                     db.server.configs.appLogsChannel = c.id;
  463.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  464.                     .then(() => {
  465.                         const successEmbed = new Discord.RichEmbed()
  466.                         .setColor(process.env.COLOR)
  467.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  468.                         .setTitle(`Successfully Changed Configurations!`)
  469.                         .setDescription(`${setting} has now been set to ${arguments}`)
  470.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  471.                         .setTimestamp()
  472.  
  473.                         return message.channel.send(successEmbed)
  474.                         .catch(error => {
  475.                             message.author.send(successEmbed)
  476.                             .catch(error => error);
  477.                             error;
  478.                         });
  479.                     });
  480.                 } else if (message.guild.channels.get(arguments)) {
  481.                     db.server.configs.appLogsChannel = arguments;
  482.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  483.                     .then(() => {
  484.                         const successEmbed = new Discord.RichEmbed()
  485.                         .setColor(process.env.COLOR)
  486.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  487.                         .setTitle(`Successfully Changed Configurations!`)
  488.                         .setDescription(`${setting} has now been set to ${arguments}`)
  489.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  490.                         .setTimestamp()
  491.  
  492.                         return message.channel.send(successEmbed)
  493.                         .catch(error => {
  494.                             message.author.send(successEmbed)
  495.                             .catch(error => error);
  496.                             error;
  497.                         });
  498.                     });
  499.                 } else {
  500.                     return message.reply(`I was unable to find the channel \`${arguments}\`.`)
  501.                     .catch(error => {
  502.                         message.author.send(`I was unable to find the channel \`${arguments}\`.`)
  503.                         .catch(error => error);
  504.                         error;
  505.                     });
  506.                 }
  507.  
  508.         } else if (setting.toLowerCase() === 'level-rewards') {
  509.             return message.reply(`Level rewards coming soon!`);
  510.             if (!arguments) {
  511.                 const argsList = new Discord.RichEmbed()
  512.                 .setColor(process.env.COLOR)
  513.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  514.                 .setTitle(`List of Arguments!`)
  515.                 .setDescription(`<level> <role> <expire at what level (coming to premium soon!)>`)
  516.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  517.                 .setTimestamp()
  518.  
  519.                 return message.channel.send(argsList)
  520.             .catch(error => {
  521.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  522.                 .then(() => {
  523.                     message.author.send(argsList);
  524.                 })
  525.                 .catch(error => error);
  526.                 error;
  527.             });
  528.  
  529.             }
  530.  
  531.         } else if (setting.toLowerCase() === 'xp-rate') {
  532.             if (!arguments) {
  533.                 const argsList = new Discord.RichEmbed()
  534.                 .setColor(process.env.COLOR)
  535.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  536.                 .setTitle(`List of Arguments!`)
  537.                 .addField(`Free`, `0.5\n1\n1.5`, true)
  538.                 .addField(`Premium`, `Any number between 0.1-100`, true)
  539.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  540.                 .setTimestamp()
  541.  
  542.                 return message.channel.send(argsList)
  543.             .catch(error => {
  544.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  545.                 .then(() => {
  546.                     message.author.send(argsList);
  547.                 })
  548.                 .catch(error => error);
  549.                 error;
  550.             });
  551.  
  552.             }
  553.  
  554.             if (db.server.configs.premium === 'false') {
  555.                 if (arguments === 0.5 || arguments === 1 || arguments === 1.5) {
  556.                     db.server.configs.xprate = arguments;
  557.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  558.                     .then(() => {
  559.                         const successEmbed = new Discord.RichEmbed()
  560.                         .setColor(process.env.COLOR)
  561.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  562.                         .setTitle(`Successfully Changed Configurations!`)
  563.                         .setDescription(`${setting} has now been set to ${arguments}`)
  564.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  565.                         .setTimestamp()
  566.  
  567.                         return message.channel.send(successEmbed)
  568.                         .catch(error => {
  569.                             message.author.send(successEmbed)
  570.                             .catch(error => error);
  571.                             error;
  572.                         });
  573.                     });
  574.                 } else {
  575.                     return message.reply(`I am sorry. Non-Premium servers are restricted to the options \`0.5\`, \`1\`, \`1.5\``)
  576.                     .catch(error => {
  577.                         message.author.send(`I am sorry. Non-Premium servers are restricted to the options \`0.5\`, \`1\`, \`1.5\``)
  578.                         .catch(error => error);
  579.                         error;
  580.                     });
  581.                 }
  582.             } else if (db.server.configs.premium === 'true') {
  583.                 if (arguments >= 0.1 && arguments <= 100) {
  584.                     db.server.configs.xprate = arguments;
  585.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  586.                     .then(() => {
  587.                         const successEmbed = new Discord.RichEmbed()
  588.                         .setColor(process.env.COLOR)
  589.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  590.                         .setTitle(`Successfully Changed Configurations!`)
  591.                         .setDescription(`${setting} has now been set to ${arguments}`)
  592.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  593.                         .setTimestamp()
  594.  
  595.                         return message.channel.send(successEmbed)
  596.                         .catch(error => {
  597.                             message.author.send(successEmbed)
  598.                             .catch(error => error);
  599.                             error;
  600.                         });
  601.                     });
  602.                 } else {
  603.                     return message.reply(`Please keep the number between \`0.1\` and \`100\``)
  604.                     .catch(error => {
  605.                         message.author.send(`Please keep the number between \`0.1\` and \`100\``)
  606.                         .catch(error => error);
  607.                         error;
  608.                     });
  609.                 }
  610.             }
  611.  
  612.  
  613.         } else if (setting.toLowerCase() === 'premium') {
  614.             return message.channel.send(`Premium coming soon.`);
  615.             const devGuild = client.guilds.get(`642304841170812939`);
  616.             let Author = devGuild.member(message.author);
  617.             if (!Author) return message.reply(`You need to be in the official development server, in order to active Premium.\nhttps://discord.gg/Ak9FTxS`);
  618.            
  619.             if (!Author.roles.some()) {
  620.  
  621.             }
  622.             if (!arguments) {
  623.                 const argsList = new Discord.RichEmbed()
  624.                 .setColor(process.env.COLOR)
  625.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  626.                 .setTitle(`List of Arguments!`)
  627.                 .addField(`On`, On.join('\n '), true)
  628.                 .addField(`Off`, Off.join('\n '), true)
  629.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  630.                 .setTimestamp()
  631.  
  632.                 return message.channel.send(argsList)
  633.             .catch(error => {
  634.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  635.                 .then(() => {
  636.                     message.author.send(argsList);
  637.                 })
  638.                 .catch(error => error);
  639.                 error;
  640.             });
  641.  
  642.             }
  643.            
  644.             if (On.includes(arguments.toLowerCase())) {
  645.                 db.server.configs.punishLogs = 'true';
  646.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  647.                     .then(() => {
  648.                         const successEmbed = new Discord.RichEmbed()
  649.                         .setColor(process.env.COLOR)
  650.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  651.                         .setTitle(`Successfully Changed Configurations!`)
  652.                         .setDescription(`${setting} has now been set to ${arguments}`)
  653.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  654.                         .setTimestamp()
  655.  
  656.                         return message.channel.send(successEmbed)
  657.                         .catch(error => {
  658.                             message.author.send(successEmbed)
  659.                             .catch(error => error);
  660.                             error;
  661.                         });
  662.                     }).catch(error => error);
  663.             } else if (Off.includes(arguments.toLowerCase())) {
  664.                 db.server.configs.punishLogs = 'false';
  665.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  666.                     .then(() => {
  667.                         const successEmbed = new Discord.RichEmbed()
  668.                         .setColor(process.env.COLOR)
  669.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  670.                         .setTitle(`Successfully Changed Configurations!`)
  671.                         .setDescription(`${setting} has now been set to ${arguments}`)
  672.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  673.                         .setTimestamp()
  674.  
  675.                         return message.channel.send(successEmbed)
  676.                         .catch(error => {
  677.                             message.author.send(successEmbed)
  678.                             .catch(error => error);
  679.                             error;
  680.                         });
  681.                     });
  682.             } else {
  683.                 const argsList = new Discord.RichEmbed()
  684.                 .setColor(process.env.COLOR)
  685.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  686.                 .setTitle(`List of Arguments!`)
  687.                 .addField(`On`, On.join('\n '), true)
  688.                 .addField(`Off`, Off.join('\n '), true)
  689.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  690.                 .setTimestamp()
  691.  
  692.                 return message.channel.send(argsList)
  693.                 .catch(error => {
  694.                     message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  695.                     .then(() => {
  696.                         message.author.send(argsList);
  697.                     })
  698.                     .catch(error => error);
  699.                     error;
  700.                 });
  701.             }
  702.  
  703.         } else if (setting.toLowerCase() === 'level-msgs') {
  704.             if (!arguments) {
  705.                 const argsList = new Discord.RichEmbed()
  706.                 .setColor(process.env.COLOR)
  707.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  708.                 .setTitle(`List of Arguments!`)
  709.                 .addField(`On`, On.join('\n '), true)
  710.                 .addField(`Off`, Off.join('\n '), true)
  711.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  712.                 .setTimestamp()
  713.  
  714.                 return message.channel.send(argsList)
  715.             .catch(error => {
  716.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  717.                 .then(() => {
  718.                     message.author.send(argsList);
  719.                 })
  720.                 .catch(error => error);
  721.                 error;
  722.             });
  723.  
  724.             }
  725.            
  726.             if (On.includes(arguments.toLowerCase())) {
  727.                 db.server.configs.levelMsgs = 'true';
  728.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  729.                     .then(() => {
  730.                         const successEmbed = new Discord.RichEmbed()
  731.                         .setColor(process.env.COLOR)
  732.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  733.                         .setTitle(`Successfully Changed Configurations!`)
  734.                         .setDescription(`${setting} has now been set to ${arguments}`)
  735.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  736.                         .setTimestamp()
  737.  
  738.                         return message.channel.send(successEmbed)
  739.                         .catch(error => {
  740.                             message.author.send(successEmbed)
  741.                             .catch(error => error);
  742.                             error;
  743.                         });
  744.                     });
  745.             } else if (Off.includes(arguments.toLowerCase())) {
  746.                 db.server.configs.levelMsgs = 'false';
  747.                 return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  748.                     .then(() => {
  749.                         const successEmbed = new Discord.RichEmbed()
  750.                         .setColor(process.env.COLOR)
  751.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  752.                         .setTitle(`Successfully Changed Configurations!`)
  753.                         .setDescription(`${setting} has now been set to ${arguments}`)
  754.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  755.                         .setTimestamp()
  756.  
  757.                         return message.channel.send(successEmbed)
  758.                         .catch(error => {
  759.                             message.author.send(successEmbed)
  760.                             .catch(error => error);
  761.                             error;
  762.                         });
  763.                     });
  764.             } else {
  765.                 const argsList = new Discord.RichEmbed()
  766.                 .setColor(process.env.COLOR)
  767.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  768.                 .setTitle(`List of Arguments!`)
  769.                 .addField(`On`, On.join('\n '), true)
  770.                 .addField(`Off`, Off.join('\n '), true)
  771.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  772.                 .setTimestamp()
  773.  
  774.                 return message.channel.send(argsList)
  775.                 .catch(error => {
  776.                     message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  777.                     .then(() => {
  778.                         message.author.send(argsList);
  779.                     })
  780.                     .catch(error => error);
  781.                     error;
  782.                 });
  783.             }
  784.  
  785.         } else if (setting.toLowerCase() === 'level-channel') {
  786.             if (!arguments) {
  787.                 const argsList = new Discord.RichEmbed()
  788.                 .setColor(process.env.COLOR)
  789.                 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  790.                 .setTitle(`List of Arguments!`)
  791.                 .setDescription(`ChannelID`)
  792.                 .setFooter(`${message.author.tag}`, message.author.avatarURL)
  793.                 .setTimestamp()
  794.  
  795.                 return message.channel.send(argsList)
  796.             .catch(error => {
  797.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  798.                 .then(() => {
  799.                     message.author.send(argsList);
  800.                 })
  801.                 .catch(error => error);
  802.                 error;
  803.             });
  804.  
  805.             }
  806.  
  807.                 arguments = args.slice(1).join(' ');
  808.                 if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
  809.                     let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
  810.                     db.server.configs.levelChannel = c.id;
  811.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  812.                     .then(() => {
  813.                         const successEmbed = new Discord.RichEmbed()
  814.                         .setColor(process.env.COLOR)
  815.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  816.                         .setTitle(`Successfully Changed Configurations!`)
  817.                         .setDescription(`${setting} has now been set to ${arguments}`)
  818.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  819.                         .setTimestamp()
  820.  
  821.                         return message.channel.send(successEmbed)
  822.                         .catch(error => {
  823.                             message.author.send(successEmbed)
  824.                             .catch(error => error);
  825.                             error;
  826.                         });
  827.                     });
  828.                 } else if (message.guild.channels.get(arguments)) {
  829.                     db.server.configs.levelChannel = arguments;
  830.                     return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  831.                     .then(() => {
  832.                         const successEmbed = new Discord.RichEmbed()
  833.                         .setColor(process.env.COLOR)
  834.                         .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  835.                         .setTitle(`Successfully Changed Configurations!`)
  836.                         .setDescription(`${setting} has now been set to ${arguments}`)
  837.                         .setFooter(`${message.author.tag}`, message.author.avatarURL)
  838.                         .setTimestamp()
  839.  
  840.                         return message.channel.send(successEmbed)
  841.                         .catch(error => {
  842.                             message.author.send(successEmbed)
  843.                             .catch(error => error);
  844.                             error;
  845.                         });
  846.                     });
  847.                 } else {
  848.                     return message.reply(`I was unable to find the channel \`${arguments}\`.`)
  849.                     .catch(error => {
  850.                         message.author.send(`I was unable to find the channel \`${arguments}\`.`)
  851.                         .catch(error => error);
  852.                         error;
  853.                     });
  854.                 }
  855.  
  856.  
  857.         } else if (setting.toLowerCase() === 'level-message') {
  858.             arguments = args.slice(1).join(' ');
  859.             if (!arguments.includes('{member}') || !arguments.includes('{level}')) {
  860.                 return message.reply(`Please use \`{member}\` and \`{level}\` once each in the message.`);
  861.             }
  862.  
  863.             db.server.configs.levelMsg = arguments;
  864.             return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
  865.                 .then(() => {
  866.                     const successEmbed = new Discord.RichEmbed()
  867.                     .setColor(process.env.COLOR)
  868.                     .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  869.                     .setTitle(`Successfully Changed Configurations!`)
  870.                     .setDescription(`${setting} has now been set to ${arguments}`)
  871.                     .setFooter(`${message.author.tag}`, message.author.avatarURL)
  872.                     .setTimestamp()
  873.  
  874.                     return message.channel.send(successEmbed)
  875.                     .catch(error => {
  876.                         message.author.send(successEmbed)
  877.                         .catch(error => error);
  878.                         error;
  879.                     });
  880.                 });
  881.  
  882.  
  883.         } else {
  884.             const settingsList = new Discord.RichEmbed()
  885.             .setColor(process.env.COLOR)
  886.             .setAuthor(`${message.guild.name}`, message.guild.iconURL)
  887.             .setTitle(`List of Settings!`)
  888.             .addField(`Moderation`, `mod-logs\nmod-logs-channel\naction-logs\naction-logs-channel\napp-logs\napp-logs-channel`, true)
  889.             .addField(`Levels`, `level-rewards\nxp-rate\nlevel-msgs\nlevel-channel\nlevel-message`, true)
  890.             .addField(`Supporter`, `premium`, true)
  891.             .setFooter(`${message.author.tag}`, message.author.avatarURL)
  892.             .setTimestamp()
  893.  
  894.             return message.channel.send(settingsList)
  895.             .catch(error => {
  896.                 message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
  897.                 .then(() => {
  898.                     message.author.send(settingsList);
  899.                 })
  900.                 .catch(error => error);
  901.                 error;
  902.             });
  903.         }
  904.     });
  905.     }
  906. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement