Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const fse = require('fs-extra');
- module.exports = {
- name: "config",
- description: "Configure the bot for your server.",
- alaises: ['configs', 'settings', 'guildsettings', 'dashboard'],
- usage: '<setting> <arguments>',
- category: 'manager',
- guildOnly: true,
- example: 'No example.',
- code(client, message, args) {
- 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.`);
- fse.readJson(`./databases/${message.guild.id}.json`, (err, db) => {
- if (err) return message.reply(`Error, ${err}`).then(console.error(err));
- let setting = args[0];
- if (!setting) {
- const settingsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Settings!`)
- .addField(`Moderation`, `mod-logs\nmod-logs-channel\naction-logs\naction-logs-channel\napp-logs\napp-logs-channel`, true)
- .addField(`Levels`, `level-rewards\nxp-rate\nlevel-msgs\nlevel-channel\nlevel-message`, true)
- .addField(`Supporter`, `premium`, true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(settingsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(settingsList);
- })
- .catch(error => error);
- error;
- });
- }
- let arguments = args.slice(1).join(' ');
- let On = ['true', 'on', 'yes', 'enable'];
- let Off = ['false', 'off', 'no', 'disable'];
- if (setting.toLowerCase() === 'mod-logs') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .setDescription(`Right now, Mod Logs is set to ${db.server.configs.punishLogs}`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- if (On.includes(arguments.toLowerCase())) {
- db.server.configs.punishLogs = 'true';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (Off.includes(arguments.toLowerCase())) {
- db.server.configs.punishLogs = 'false';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'mod-logs-channel') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .setDescription(`ChannelID`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- arguments = args.slice(1).join(' ');
- if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
- let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
- db.server.configs.modLogsChannel = c.id;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (message.guild.channels.get(arguments)) {
- db.server.configs.modLogsChannel = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- return message.reply(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => {
- message.author.send(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'action-logs') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- if (On.includes(arguments.toLowerCase())) {
- db.server.configs.actionLogs = 'true';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (Off.includes(arguments.toLowerCase())) {
- db.server.configs.actionLogs = 'false';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'action-logs-channel') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .setDescription(`ChannelID`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- arguments = args.slice(1).join(' ');
- if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
- let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
- db.server.configs.actionLogsChannel = c.id;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (message.guild.channels.get(arguments)) {
- db.server.configs.actionLogsChannel = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- return message.reply(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => {
- message.author.send(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'app-logs') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- if (On.includes(arguments.toLowerCase())) {
- db.server.configs.appLogs = 'true';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (Off.includes(arguments.toLowerCase())) {
- db.server.configs.appLogs = 'false';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'app-logs-channel') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .setDescription(`ChannelID`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- arguments = args.slice(1).join(' ');
- if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
- let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
- db.server.configs.appLogsChannel = c.id;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (message.guild.channels.get(arguments)) {
- db.server.configs.appLogsChannel = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- return message.reply(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => {
- message.author.send(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'level-rewards') {
- return message.reply(`Level rewards coming soon!`);
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .setDescription(`<level> <role> <expire at what level (coming to premium soon!)>`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'xp-rate') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`Free`, `0.5\n1\n1.5`, true)
- .addField(`Premium`, `Any number between 0.1-100`, true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- if (db.server.configs.premium === 'false') {
- if (arguments === 0.5 || arguments === 1 || arguments === 1.5) {
- db.server.configs.xprate = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- return message.reply(`I am sorry. Non-Premium servers are restricted to the options \`0.5\`, \`1\`, \`1.5\``)
- .catch(error => {
- message.author.send(`I am sorry. Non-Premium servers are restricted to the options \`0.5\`, \`1\`, \`1.5\``)
- .catch(error => error);
- error;
- });
- }
- } else if (db.server.configs.premium === 'true') {
- if (arguments >= 0.1 && arguments <= 100) {
- db.server.configs.xprate = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- return message.reply(`Please keep the number between \`0.1\` and \`100\``)
- .catch(error => {
- message.author.send(`Please keep the number between \`0.1\` and \`100\``)
- .catch(error => error);
- error;
- });
- }
- }
- } else if (setting.toLowerCase() === 'premium') {
- return message.channel.send(`Premium coming soon.`);
- const devGuild = client.guilds.get(`642304841170812939`);
- let Author = devGuild.member(message.author);
- if (!Author) return message.reply(`You need to be in the official development server, in order to active Premium.\nhttps://discord.gg/Ak9FTxS`);
- if (!Author.roles.some()) {
- }
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- if (On.includes(arguments.toLowerCase())) {
- db.server.configs.punishLogs = 'true';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- }).catch(error => error);
- } else if (Off.includes(arguments.toLowerCase())) {
- db.server.configs.punishLogs = 'false';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'level-msgs') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- if (On.includes(arguments.toLowerCase())) {
- db.server.configs.levelMsgs = 'true';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (Off.includes(arguments.toLowerCase())) {
- db.server.configs.levelMsgs = 'false';
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .addField(`On`, On.join('\n '), true)
- .addField(`Off`, Off.join('\n '), true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'level-channel') {
- if (!arguments) {
- const argsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Arguments!`)
- .setDescription(`ChannelID`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(argsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(argsList);
- })
- .catch(error => error);
- error;
- });
- }
- arguments = args.slice(1).join(' ');
- if (message.guild.channels.find(c => c.name === arguments.toLowerCase())) {
- let c = message.guild.channels.find(c => c.name === arguments.toLowerCase());
- db.server.configs.levelChannel = c.id;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else if (message.guild.channels.get(arguments)) {
- db.server.configs.levelChannel = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- return message.reply(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => {
- message.author.send(`I was unable to find the channel \`${arguments}\`.`)
- .catch(error => error);
- error;
- });
- }
- } else if (setting.toLowerCase() === 'level-message') {
- arguments = args.slice(1).join(' ');
- if (!arguments.includes('{member}') || !arguments.includes('{level}')) {
- return message.reply(`Please use \`{member}\` and \`{level}\` once each in the message.`);
- }
- db.server.configs.levelMsg = arguments;
- return fse.writeFile(`./databases/${message.guild.id}.json`, JSON.stringify(db, null, 2))
- .then(() => {
- const successEmbed = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`Successfully Changed Configurations!`)
- .setDescription(`${setting} has now been set to ${arguments}`)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(successEmbed)
- .catch(error => {
- message.author.send(successEmbed)
- .catch(error => error);
- error;
- });
- });
- } else {
- const settingsList = new Discord.RichEmbed()
- .setColor(process.env.COLOR)
- .setAuthor(`${message.guild.name}`, message.guild.iconURL)
- .setTitle(`List of Settings!`)
- .addField(`Moderation`, `mod-logs\nmod-logs-channel\naction-logs\naction-logs-channel\napp-logs\napp-logs-channel`, true)
- .addField(`Levels`, `level-rewards\nxp-rate\nlevel-msgs\nlevel-channel\nlevel-message`, true)
- .addField(`Supporter`, `premium`, true)
- .setFooter(`${message.author.tag}`, message.author.avatarURL)
- .setTimestamp()
- return message.channel.send(settingsList)
- .catch(error => {
- message.author.send(`I was unable to send the list to #${message.channel.name}. Here it is instead.`)
- .then(() => {
- message.author.send(settingsList);
- })
- .catch(error => error);
- error;
- });
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement