diff --git a/base/JaBa.js b/base/JaBa.js index c05b4d18..c550ccfd 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -19,7 +19,7 @@ moment.relativeTimeThreshold("M", 12); // Creates JaBa class class JaBa extends Client { - constructor (options) { + constructor(options) { super(options); this.config = require("../config"); // Load the config file this.customEmojis = require("../emojis.json"); // load the bot's emojis @@ -47,7 +47,9 @@ class JaBa extends Client { this.databaseCache.mutedUsers = new Collection(); // members who are currently muted if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste); - if (this.config.apiKeys.blagueXYZ) this.joker = new Joker(this.config.apiKeys.blagueXYZ, { defaultLanguage: "en" }); + if (this.config.apiKeys.blagueXYZ) this.joker = new Joker(this.config.apiKeys.blagueXYZ, { + defaultLanguage: "en" + }); this.player = new DisTube.default(this, { searchSongs: 10, @@ -56,7 +58,7 @@ class JaBa extends Client { emptyCooldown: 0, leaveOnFinish: true, leaveOnStop: true, - plugins: [ new SoundCloudPlugin(), new SpotifyPlugin() ], + plugins: [new SoundCloudPlugin(), new SpotifyPlugin()], }); this.player @@ -73,11 +75,13 @@ class JaBa extends Client { }) .on("searchDone", () => {}) .on("searchCancel", message => message.error("misc:TIMES_UP")) - .on("searchInvalidAnswer", message => message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: tracks.length })) + .on("searchInvalidAnswer", message => message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 })) .on("searchNoResult", message => message.error("music/play:NO_RESULT")) .on("error", (textChannel, e) => { console.error(e); - textChannel.send(this.translate("music/play:ERR_OCCURRED", { error: e })); + textChannel.send(this.translate("music/play:ERR_OCCURRED", { + error: e + })); }) .on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED"))) .on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED"))) @@ -129,7 +133,7 @@ class JaBa extends Client { // This function is used to load a command and add it to the collection loadCommand(commandPath, commandName) { try { - const props = new (require(`.${commandPath}${path.sep}${commandName}`))(this); + const props = new(require(`.${commandPath}${path.sep}${commandName}`))(this); this.logger.log(`Loading Command: ${props.help.name}. 👌`, "log"); props.conf.location = commandPath; if (props.init) props.init(this); @@ -146,7 +150,7 @@ class JaBa extends Client { }; // This function is used to unload a command (you need to load them again) - async unloadCommand (commandPath, commandName) { + async unloadCommand(commandPath, commandName) { let command; if (this.commands.has(commandName)) command = this.commands.get(commandName); else if (this.aliases.has(commandName)) command = this.commands.get(this.aliases.get(commandName)); @@ -163,13 +167,19 @@ class JaBa extends Client { async findOrCreateUser({ id: userID }, isLean) { if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID); else { - let userData = (isLean ? await this.usersData.findOne({ id: userID }).lean() : await this.usersData.findOne({ id: userID })); + let userData = (isLean ? await this.usersData.findOne({ + id: userID + }).lean() : await this.usersData.findOne({ + id: userID + })); if (userData) { if (!isLean) this.databaseCache.users.set(userID, userData); return userData; } else { - userData = new this.usersData({ id: userID }); + userData = new this.usersData({ + id: userID + }); await userData.save(); this.databaseCache.users.set(userID, userData); @@ -182,15 +192,26 @@ class JaBa extends Client { async findOrCreateMember({ id: memberID, guildID }, isLean) { if (this.databaseCache.members.get(`${memberID}${guildID}`)) return isLean ? this.databaseCache.members.get(`${memberID}${guildID}`).toJSON() : this.databaseCache.members.get(`${memberID}${guildID}`); else { - let memberData = (isLean ? await this.membersData.findOne({ guildID, id: memberID }).lean() : await this.membersData.findOne({ guildID, id: memberID })); + let memberData = (isLean ? await this.membersData.findOne({ + guildID, + id: memberID + }).lean() : await this.membersData.findOne({ + guildID, + id: memberID + })); if (memberData) { if (!isLean) this.databaseCache.members.set(`${memberID}${guildID}`, memberData); return memberData; } else { - memberData = new this.membersData({ id: memberID, guildID: guildID }); + memberData = new this.membersData({ + id: memberID, + guildID: guildID + }); await memberData.save(); - const guild = await this.findOrCreateGuild({ id: guildID }); + const guild = await this.findOrCreateGuild({ + id: guildID + }); if (guild) { guild.members.push(memberData._id); await guild.save(); @@ -206,13 +227,19 @@ class JaBa extends Client { async findOrCreateGuild({ id: guildID }, isLean) { if (this.databaseCache.guilds.get(guildID)) return isLean ? this.databaseCache.guilds.get(guildID).toJSON() : this.databaseCache.guilds.get(guildID); else { - let guildData = (isLean ? await this.guildsData.findOne({ id: guildID }).populate("members").lean() : await this.guildsData.findOne({ id: guildID }).populate("members")); + let guildData = (isLean ? await this.guildsData.findOne({ + id: guildID + }).populate("members").lean() : await this.guildsData.findOne({ + id: guildID + }).populate("members")); if (guildData) { if (!isLean) this.databaseCache.guilds.set(guildID, guildData); return guildData; } else { - guildData = new this.guildsData({ id: guildID }); + guildData = new this.guildsData({ + id: guildID + }); await guildData.save(); this.databaseCache.guilds.set(guildID, guildData); diff --git a/commands/Administration/addcommand.js b/commands/Administration/addcommand.js index 381d3f5d..e9e3db6f 100644 --- a/commands/Administration/addcommand.js +++ b/commands/Administration/addcommand.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Addcommand extends Command { - constructor (client) { + constructor(client) { super(client, { name: "addcommand", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "custom-command" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["custom-command"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (!args[0]) return message.error("administration/addcommand:MISSING_NAME"); const name = args[0].split("\n")[0]; @@ -32,7 +32,10 @@ class Addcommand extends Command { }); data.guild.save(); - message.success("administration/addcommand:SUCCESS", { commandName: name, prefix: data.guild.prefix }); + message.success("administration/addcommand:SUCCESS", { + commandName: name, + prefix: data.guild.prefix + }); } }; diff --git a/commands/Administration/addemoji.js b/commands/Administration/addemoji.js index 020513d3..4cb9d882 100644 --- a/commands/Administration/addemoji.js +++ b/commands/Administration/addemoji.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Addemoji extends Command { - constructor (client) { + constructor(client) { super(client, { name: "addemoji", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { const URL = args[0]; if (!URL) return message.error("administration/addemoji:MISSING_URL"); @@ -26,12 +26,8 @@ class Addemoji extends Command { message.guild.emojis .create(URL, name) - .then(emoji => { - message.success("administration/addemoji:SUCCESS", { emojiName: emoji.name }); - }) - .catch(() => { - message.error("administration/addemoji:ERROR", { emojiName: name }); - }); + .then(emoji => message.success("administration/addemoji:SUCCESS", { emojiName: emoji.name })) + .catch(() => message.error("administration/addemoji:ERROR", { emojiName: name })); } }; diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js index 20f1f6ff..a6c61cbb 100644 --- a/commands/Administration/automod.js +++ b/commands/Administration/automod.js @@ -1,39 +1,49 @@ const Command = require("../../base/Command.js"); class Automod extends Command { - constructor (client) { + constructor(client) { super(client, { name: "automod", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args,data) { + async run(message, args, data) { const status = args[0]; if (!status || (status !== "on" && status !== "off")) return message.error("administration/automod:MISSING_STATUS"); if (status === "on") { - data.guild.plugins.automod = { enabled: true, ignored: [] }; + data.guild.plugins.automod = { + enabled: true, + ignored: [] + }; data.guild.markModified("plugins.automod"); data.guild.save(); - message.success("administration/automod:ENABLED", { prefix: data.guild.prefix }); + message.success("administration/automod:ENABLED", { + prefix: data.guild.prefix + }); } else if (status === "off") { if (message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first()) { const channel = message.mentions.channels.first(); data.guild.plugins.automod.ignored.push(channel); data.guild.markModified("plugins.automod"); data.guild.save(); - message.success("administration/automod:DISABLED_CHANNEL", { channel: channel.toString() }); + message.success("administration/automod:DISABLED_CHANNEL", { + channel: channel.toString() + }); } else { - data.guild.plugins.automod = { enabled: false, ignored: [] }; + data.guild.plugins.automod = { + enabled: false, + ignored: [] + }; data.guild.markModified("plugins.automod"); data.guild.save(); message.success("administration/automod:DISABLED"); diff --git a/commands/Administration/autorole.js b/commands/Administration/autorole.js index 08e1e761..2e4901f9 100644 --- a/commands/Administration/autorole.js +++ b/commands/Administration/autorole.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Resolvers = require("../../helpers/resolvers"); class Autorole extends Command { - constructor (client) { + constructor(client) { super(client, { name: "autorole", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "ar" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["ar"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const status = args[0]; if (status !== "on" && status !== "off") return message.error("administration/autorole:MISSING_STATUS"); @@ -39,7 +39,9 @@ class Autorole extends Command { roleName: role.name }); } else if (status === "off") { - if (!data.guild.plugins.autorole.enabled) return message.success("administration/autorole:ALREADY_DISABLED", { prefix: data.guild.prefix }); + if (!data.guild.plugins.autorole.enabled) return message.success("administration/autorole:ALREADY_DISABLED", { + prefix: data.guild.prefix + }); data.guild.plugins.autorole = { enabled: false, @@ -48,7 +50,9 @@ class Autorole extends Command { data.guild.markModified("plugins.autorole"); await data.guild.save(); - message.success("administration/autorole:SUCCESS_DISABLED", { prefix: data.guild.prefix }); + message.success("administration/autorole:SUCCESS_DISABLED", { + prefix: data.guild.prefix + }); }; } }; diff --git a/commands/Administration/backup.js b/commands/Administration/backup.js index e226fc44..db0bb715 100644 --- a/commands/Administration/backup.js +++ b/commands/Administration/backup.js @@ -4,31 +4,35 @@ const Command = require("../../base/Command.js"), Sentry = require("@sentry/node"); class Backup extends Command { - constructor (client) { + constructor(client) { super(client, { name: "backup", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ADMINISTRATOR" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ADMINISTRATOR"], nsfw: false, ownerOnly: false, cooldown: 30000 }); } - async run (message, args, data) { + async run(message, args, data) { const status = args[0]; if (!status) return message.error("administration/backup:MISSING_STATUS"); if (status === "create") { - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); backup.create(message.guild).then((backup) => { m.delete(); message.success("administration/backup:SUCCESS_PUBLIC"); - message.author.send(message.translate("administration/backup:SUCCESS_PRIVATE", { backupID: backup.id })).catch(() => { + message.author.send(message.translate("administration/backup:SUCCESS_PRIVATE", { + backupID: backup.id + })).catch(() => { backup.remove(backup.id); message.error("misc:CANNOT_DM"); }); @@ -88,7 +92,9 @@ class Backup extends Command { message.channel.send(embed); }).catch(() => { // if the backup wasn't found - return message.error("administration/backup:NO_BACKUP_FOUND", { backupID }); + return message.error("administration/backup:NO_BACKUP_FOUND", { + backupID + }); }); } else { return message.error("administration/backup:MISSING_STATUS"); diff --git a/commands/Administration/configuration.js b/commands/Administration/configuration.js index 0e896e9d..5155d1b7 100644 --- a/commands/Administration/configuration.js +++ b/commands/Administration/configuration.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Configuration extends Command { - constructor (client) { + constructor(client) { super(client, { name: "configuration", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "conf", "config" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["conf", "config"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const guildData = data.guild; const embed = new Discord.MessageEmbed() @@ -32,13 +32,21 @@ class Configuration extends Command { embed.addField(message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS")); // Autorole plugin - embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", { roleName: `<@&${guildData.plugins.autorole.role}>` }) : message.translate("administration/configuration:AUTOROLE_DISABLED")); + embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", { + roleName: `<@&${guildData.plugins.autorole.role}>` + }) : message.translate("administration/configuration:AUTOROLE_DISABLED")); // Welcome plugin - embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", { channel: `<#${guildData.plugins.welcome.channel}>`, withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO") }) : message.translate("administration/configuration:WELCOME_DISABLED")); + embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", { + channel: `<#${guildData.plugins.welcome.channel}>`, + withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO") + }) : message.translate("administration/configuration:WELCOME_DISABLED")); // Goodbye plugin - embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", { channel: `<#${guildData.plugins.goodbye.channel}>`, withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO") }) : message.translate("administration/configuration:GOODBYE_DISABLED")); + embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", { + channel: `<#${guildData.plugins.goodbye.channel}>`, + withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO") + }) : message.translate("administration/configuration:GOODBYE_DISABLED")); // Special channels embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"), @@ -57,10 +65,16 @@ class Configuration extends Command { ); // Auto sanctions - embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", { count: guildData.plugins.warnsSanctions.kick }) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", { count: guildData.plugins.warnsSanctions.ban }) : message.translate("administration/configuration:BAN_NOT_DEFINED"))); + embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", { + count: guildData.plugins.warnsSanctions.kick + }) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", { + count: guildData.plugins.warnsSanctions.ban + }) : message.translate("administration/configuration:BAN_NOT_DEFINED"))); // Automod plugin - embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", { channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`) }) : message.translate("administration/configuration:AUTOMOD_DISABLED")); + embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", { + channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`) + }) : message.translate("administration/configuration:AUTOMOD_DISABLED")); // Auto-delete mod commands embed.addField(message.translate("administration/configuration:AUTODELETEMOD"), guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED")); diff --git a/commands/Administration/delcommand.js b/commands/Administration/delcommand.js index ff563697..4fe3a177 100644 --- a/commands/Administration/delcommand.js +++ b/commands/Administration/delcommand.js @@ -1,31 +1,32 @@ const Command = require("../../base/Command.js"); class Delcommand extends Command { - constructor (client) { + constructor(client) { super(client, { name: "delcommand", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const name = args[0]; if (!name) return message.error("administration/delcommand:MISSING_NAME"); - if (!data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/delcommand:UNKNOWN_COMMAND", { commandName: name }); data.guild.customCommands = data.guild.customCommands.filter((c) => c.name !== name); data.guild.save(); - message.success("administration/delcommand:SUCCESS", { commandName: name }); + message.success("administration/delcommand:SUCCESS", { + commandName: name + }); } }; diff --git a/commands/Administration/deletemod.js b/commands/Administration/deletemod.js index 7d8b0525..43c61553 100644 --- a/commands/Administration/deletemod.js +++ b/commands/Administration/deletemod.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Deletemod extends Command { - constructor (client) { + constructor(client) { super(client, { name: "deletemod", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "autodeletemodcommands" ], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["autodeletemodcommands"], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const status = args[0]; if (!status || status !== "on" && status !== "off") return message.error("administration/deletemod:MISSING_STATUS"); diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js index 5819be39..feb6af32 100644 --- a/commands/Administration/goodbye.js +++ b/commands/Administration/goodbye.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Resolvers = require("../../helpers/resolvers"); class Goodbye extends Command { - constructor (client) { + constructor(client) { super(client, { name: "goodbye", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "au-revoir" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["au-revoir"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (args[0] === "test" && data.guild.plugins.goodbye.enabled) { this.client.emit("guildMemberRemove", message.member); return message.success("administration/goodbye:TEST_SUCCESS"); @@ -34,7 +34,9 @@ class Goodbye extends Command { }; data.guild.markModified("plugins.goodbye"); data.guild.save(); - return message.error("administration/goodbye:DISABLED", { prefix: data.guild.prefix }); + return message.error("administration/goodbye:DISABLED", { + prefix: data.guild.prefix + }); } else { const goodbye = { enabled: true, @@ -43,7 +45,10 @@ class Goodbye extends Command { withImage: null, }; - message.sendT("administration/goodbye:FORM_1", { author: message.author.toString() }); + message.sendT("administration/goodbye:FORM_1", { + author: message.author.toString() + }); + const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, { time: 120000 // 2 minutes }); @@ -61,7 +66,10 @@ class Goodbye extends Command { data.guild.plugins.goodbye = goodbye; data.guild.markModified("plugins.goodbye"); await data.guild.save(); - message.sendT("administration/goodbye:FORM_SUCCESS", { prefix: data.guild.prefix, channel: `<#${goodbye.channel}>` }); + message.sendT("administration/goodbye:FORM_SUCCESS", { + prefix: data.guild.prefix, + channel: `<#${goodbye.channel}>` + }); return collector.stop(); }; diff --git a/commands/Administration/ignore.js b/commands/Administration/ignore.js index 9f7a7d7b..c452f8ce 100644 --- a/commands/Administration/ignore.js +++ b/commands/Administration/ignore.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Ignore extends Command { - constructor (client) { + constructor(client) { super(client, { name: "ignore", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "disableChannel" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["disableChannel"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); if (!channel) return message.error("misc:INVALID_CHANNEL"); @@ -25,11 +25,15 @@ class Ignore extends Command { if (ignored) { data.guild.ignoredChannels = data.guild.ignoredChannels.filter((ch) => ch !== channel.id); data.guild.save(); - return message.success("administration/ignore:ALLOWED", { channel: channel.toString() }); + return message.success("administration/ignore:ALLOWED", { + channel: channel.toString() + }); } else if (!ignored) { data.guild.ignoredChannels.push(channel.id); data.guild.save(); - return message.success("administration/ignore:IGNORED", { channel: channel.toString() }); + return message.success("administration/ignore:IGNORED", { + channel: channel.toString() + }); }; } }; diff --git a/commands/Administration/set.js b/commands/Administration/set.js index b7bb6e8a..ce367ad7 100644 --- a/commands/Administration/set.js +++ b/commands/Administration/set.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Set extends Command { - constructor (client) { + constructor(client) { super(client, { name: "set", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const status = args[0]; if (!status || !["level", "xp", "credits", "bank"].includes(status)) return message.error("administration/set:NO_STATUS"); @@ -28,7 +28,10 @@ class Set extends Command { if (!number || isNaN(number) || parseInt(number, 10) <= 0) return message.error("administration/set:INVALID_AMOUNT"); const amount = Math.ceil(parseInt(number, 10)); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); if (status === "level") { memberData.level = parseInt(amount, 10); @@ -44,7 +47,10 @@ class Set extends Command { memberData.save(); } - message.success("administration/set:SUCCESS_" + status.toUpperCase() , { username: member.user.tag, amount }); + message.success("administration/set:SUCCESS_" + status.toUpperCase(), { + username: member.user.tag, + amount + }); } }; diff --git a/commands/Administration/setfortniteshop.js b/commands/Administration/setfortniteshop.js index d3b444a7..a2988676 100644 --- a/commands/Administration/setfortniteshop.js +++ b/commands/Administration/setfortniteshop.js @@ -33,7 +33,9 @@ class Setfortniteshop extends Command { data.guild.markModified("plugins.fortniteshop"); data.guild.save(); - message.success("administration/setfortniteshop:ENABLED", { channel: channel.toString() }); + message.success("administration/setfortniteshop:ENABLED", { + channel: channel.toString() + }); const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment; const shop = new Canvas.FortniteShop(); @@ -51,7 +53,13 @@ class Setfortniteshop extends Command { const attachment = new Discord.MessageAttachment(image, "shop.png"); const embed = new Discord.MessageEmbed() - .setAuthor(this.client.translate("general/fortniteshop:DATE", { date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language) }, message.guild.data.language), this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(this.client.translate("general/fortniteshop:DATE", { + date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language) + }, message.guild.data.language), this.client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .attachFiles(attachment) .setImage("attachment://shop.png") .setColor(this.client.config.embed.color) diff --git a/commands/Administration/setlang.js b/commands/Administration/setlang.js index 65f8b8e5..b8708b10 100644 --- a/commands/Administration/setlang.js +++ b/commands/Administration/setlang.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Setlang extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setlang", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const language = this.client.languages.find((l) => l.name === args[0] || l.aliases.includes(args[0])); if (!args[0] || !language) return message.error("administration/setlang:MISSING_LANG", { list: this.client.languages.map((l) => `\`${l.name}\``).join(", ") }); @@ -24,7 +24,9 @@ class Setlang extends Command { data.guild.language = language.name; await data.guild.save(); - return message.sendT("administration/setlang:SUCCESS", { lang: language.nativeName }); + return message.sendT("administration/setlang:SUCCESS", { + lang: language.nativeName + }); } }; diff --git a/commands/Administration/setmodlogs.js b/commands/Administration/setmodlogs.js index 663f6b1d..77d2a305 100644 --- a/commands/Administration/setmodlogs.js +++ b/commands/Administration/setmodlogs.js @@ -2,24 +2,28 @@ const Command = require("../../base/Command.js"), Resolvers = require("../../helpers/resolvers"); class Setmodlogs extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setmodlogs", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "setmodlogs" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["setmodlogs"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const areModLogsEnabled = Boolean(data.guild.plugins.modlogs); - const sentChannel = await Resolvers.resolveChannel({ message, search: args.join(" "), channelType: "text" }); + const sentChannel = await Resolvers.resolveChannel({ + message, + search: args.join(" "), + channelType: "text" + }); if (!sentChannel && areModLogsEnabled) { data.guild.plugins.modlogs = null; @@ -31,7 +35,9 @@ class Setmodlogs extends Command { data.guild.plugins.modlogs = channel.id; data.guild.markModified("plugins.modlogs"); await data.guild.save(); - return message.success("administration/setmodlogs:SUCCESS_ENABLED", { channel: channel.toString() }); + return message.success("administration/setmodlogs:SUCCESS_ENABLED", { + channel: channel.toString() + }); }; } }; diff --git a/commands/Administration/setprefix.js b/commands/Administration/setprefix.js index 0641dc09..427d3da8 100644 --- a/commands/Administration/setprefix.js +++ b/commands/Administration/setprefix.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Setprefix extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setprefix", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const prefix = args[0]; if (!prefix) return message.error("administration/setprefix:MISSING_PREFIX"); if (prefix.length > 5) return message.error("administration/setprefix:TOO_LONG"); @@ -24,8 +24,9 @@ class Setprefix extends Command { data.guild.prefix = prefix; data.guild.save(); - // Sucess - return message.success("administration/setprefix:SUCCESS", { prefix }); + return message.success("administration/setprefix:SUCCESS", { + prefix + }); } }; diff --git a/commands/Administration/setreports.js b/commands/Administration/setreports.js index 960f4850..da86dc3a 100644 --- a/commands/Administration/setreports.js +++ b/commands/Administration/setreports.js @@ -2,24 +2,28 @@ const Command = require("../../base/Command.js"), Resolvers = require("../../helpers/resolvers"); class Setreports extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setreports", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "setreport"], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["setreport"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const areReportsEnabled = Boolean(data.guild.plugins.reports); - const sentChannel = await Resolvers.resolveChannel({ message, search: args.join(" "), channelType: "text" }); + const sentChannel = await Resolvers.resolveChannel({ + message, + search: args.join(" "), + channelType: "text" + }); if (!sentChannel && areReportsEnabled) { data.guild.plugins.reports = null; @@ -31,7 +35,9 @@ class Setreports extends Command { data.guild.plugins.reports = channel.id; data.guild.markModified("plugins.reports"); await data.guild.save(); - return message.success("administration/setreports:SUCCESS_ENABLED", { channel: channel.toString() }); + return message.success("administration/setreports:SUCCESS_ENABLED", { + channel: channel.toString() + }); }; } }; diff --git a/commands/Administration/setsuggests.js b/commands/Administration/setsuggests.js index fe96c6d2..e1dcbccd 100644 --- a/commands/Administration/setsuggests.js +++ b/commands/Administration/setsuggests.js @@ -2,24 +2,28 @@ const Command = require("../../base/Command.js"), Resolvers = require("../../helpers/resolvers"); class Setsuggests extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setsuggests", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "setsuggest", "setsuggestions", "setsuggestion" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["setsuggest", "setsuggestions", "setsuggestion"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const areSuggestsEnabled = Boolean(data.guild.plugins.suggestions); - const sentChannel = await Resolvers.resolveChannel({ message, search: args.join(" "), channelType: "text" }); + const sentChannel = await Resolvers.resolveChannel({ + message, + search: args.join(" "), + channelType: "text" + }); if (!sentChannel && areSuggestsEnabled) { data.guild.plugins.suggestions = null; @@ -31,7 +35,9 @@ class Setsuggests extends Command { data.guild.plugins.suggestions = channel.id; data.guild.markModified("plugins.suggestions"); await data.guild.save(); - return message.success("administration/setsuggests:SUCCESS_ENABLED", { channel: channel.toString() }); + return message.success("administration/setsuggests:SUCCESS_ENABLED", { + channel: channel.toString() + }); }; } }; diff --git a/commands/Administration/slowmode.js b/commands/Administration/slowmode.js index 68b2b0df..a117f893 100644 --- a/commands/Administration/slowmode.js +++ b/commands/Administration/slowmode.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), ms = require("ms"); class Slowmode extends Command { - constructor (client) { + constructor(client) { super(client, { name: "slowmode", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "slowmotion" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["slowmotion"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); if (!channel) return message.error("misc:INVALID_CHANNEL"); @@ -28,7 +28,10 @@ class Slowmode extends Command { data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id); data.guild.markModified("slowmode.channels"); data.guild.save(); - message.success("administration/slowmode:DISABLED", { prefix: data.guild.prefix, channel: `#${channel.name}` }); + message.success("administration/slowmode:DISABLED", { + prefix: data.guild.prefix, + channel: `#${channel.name}` + }); } else { if (isNaN(ms(time))) return message.error("misc:INVALID_TIME"); if (data.guild.slowmode.channels.find((ch) => ch.id === channel.id)) data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id); @@ -39,7 +42,11 @@ class Slowmode extends Command { }); data.guild.markModified("slowmode.channels"); data.guild.save(); - message.success("administration/slowmode:ENABLED", { prefix: data.guild.prefix, channel: `#${channel.name}`, time: this.client.functions.convertTime(message.guild, ms(time)) }); + message.success("administration/slowmode:ENABLED", { + prefix: data.guild.prefix, + channel: `#${channel.name}`, + time: this.client.functions.convertTime(message.guild, ms(time)) + }); }; } }; diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js index ffeaebb6..dbda5806 100644 --- a/commands/Administration/welcome.js +++ b/commands/Administration/welcome.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Resolvers = require("../../helpers/resolvers"); class Welcome extends Command { - constructor (client) { + constructor(client) { super(client, { name: "welcome", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "bienvenue" ], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["bienvenue"], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (args[0] === "test" && data.guild.plugins.welcome.enabled) { this.client.emit("guildMemberAdd", message.member); return message.success("administration/welcome:TEST_SUCCESS"); @@ -34,7 +34,9 @@ class Welcome extends Command { }; data.guild.markModified("plugins.welcome"); data.guild.save(); - return message.error("administration/welcome:DISABLED", { prefix: data.guild.prefix }); + return message.error("administration/welcome:DISABLED", { + prefix: data.guild.prefix + }); } else { const welcome = { enabled: true, @@ -43,7 +45,9 @@ class Welcome extends Command { withImage: null, }; - message.sendT("administration/welcome:FORM_1", { author: message.author.toString() }); + message.sendT("administration/welcome:FORM_1", { + author: message.author.toString() + }); const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, { time: 120000 // 2 minutes }); @@ -61,7 +65,10 @@ class Welcome extends Command { data.guild.plugins.welcome = welcome; data.guild.markModified("plugins.welcome"); await data.guild.save(); - message.sendT("administration/welcome:FORM_SUCCESS", { prefix: data.guild.prefix, channel: `<#${welcome.channel}>` }); + message.sendT("administration/welcome:FORM_SUCCESS", { + prefix: data.guild.prefix, + channel: `<#${welcome.channel}>` + }); return collector.stop(); }; @@ -76,7 +83,10 @@ class Welcome extends Command { // If the channel is not filled, it means the user sent it if (!welcome.channel) { - const channel = await Resolvers.resolveChannel({ message: msg, channelType: "text" }); + const channel = await Resolvers.resolveChannel({ + message: msg, + channelType: "text" + }); if (!channel) return message.error("misc:INVALID_CHANNEL"); welcome.channel = channel.id; diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js index 7feb28f2..4b19154a 100644 --- a/commands/Economy/achievements.js +++ b/commands/Economy/achievements.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Achievements extends Command { - constructor (client) { + constructor(client) { super(client, { name: "achievements", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "ac" ], + aliases: ["ac"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { const embed = new Discord.MessageEmbed() .setAuthor(message.translate("economy/achievements:TITLE")) .setColor(data.config.embed.color) @@ -26,37 +26,37 @@ class Achievements extends Command { embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.firstCommand.progress.now, total: data.userData.achievements.firstCommand.progress.total, - percent: Math.round(100 * (data.userData.achievements.firstCommand.progress.now/data.userData.achievements.firstCommand.progress.total)) + percent: Math.round(100 * (data.userData.achievements.firstCommand.progress.now / data.userData.achievements.firstCommand.progress.total)) })); embed.addField(message.translate("economy/achievements:CLAIM_SALARY"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.work.progress.now, total: data.userData.achievements.work.progress.total, - percent: Math.round(100 * (data.userData.achievements.work.progress.now/data.userData.achievements.work.progress.total)) + percent: Math.round(100 * (data.userData.achievements.work.progress.now / data.userData.achievements.work.progress.total)) })); embed.addField(message.translate("economy/achievements:MARRY"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.married.progress.now, total: data.userData.achievements.married.progress.total, - percent: Math.round(100 * (data.userData.achievements.married.progress.now/data.userData.achievements.married.progress.total)) + percent: Math.round(100 * (data.userData.achievements.married.progress.now / data.userData.achievements.married.progress.total)) })); embed.addField(message.translate("economy/achievements:SLOTS"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.slots.progress.now, total: data.userData.achievements.slots.progress.total, - percent: Math.round(100 * (data.userData.achievements.slots.progress.now/data.userData.achievements.slots.progress.total)) + percent: Math.round(100 * (data.userData.achievements.slots.progress.now / data.userData.achievements.slots.progress.total)) })); embed.addField(message.translate("economy/achievements:TIP"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.tip.progress.now, total: data.userData.achievements.tip.progress.total, - percent: Math.round(100 * (data.userData.achievements.tip.progress.now/data.userData.achievements.tip.progress.total)) + percent: Math.round(100 * (data.userData.achievements.tip.progress.now / data.userData.achievements.tip.progress.total)) })); embed.addField(message.translate("economy/achievements:REP"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.rep.progress.now, total: data.userData.achievements.rep.progress.total, - percent: Math.round(100 * (data.userData.achievements.rep.progress.now/data.userData.achievements.rep.progress.total)) + percent: Math.round(100 * (data.userData.achievements.rep.progress.now / data.userData.achievements.rep.progress.total)) })); embed.addField(message.translate("economy/achievements:INVITE"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.invite.progress.now, total: data.userData.achievements.invite.progress.total, - percent: Math.round(100 * (data.userData.achievements.invite.progress.now/data.userData.achievements.invite.progress.total)) + percent: Math.round(100 * (data.userData.achievements.invite.progress.now / data.userData.achievements.invite.progress.total)) })); message.channel.send(embed); diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js index 94c25d74..cd15ebd6 100644 --- a/commands/Economy/birthdate.js +++ b/commands/Economy/birthdate.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Birthdate extends Command { - constructor (client) { + constructor(client) { super(client, { name: "birthdate", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "anniversaire" ], + aliases: ["anniversaire"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { const date = args[0]; if (!date) return message.error("economy/birthdate:MISSING_DATE"); @@ -28,18 +28,21 @@ class Birthdate extends Command { const match = date.match(/\d+/g); if (!match) return message.error("economy/birthdate:INVALID_DATE_FORMAT"); - const tday = +match[0], tmonth = +match[1] - 1; + const tday = +match[0], + tmonth = +match[1] - 1; let tyear = +match[2]; if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900; const d = new Date(tyear, tmonth, tday); if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE_FORMAT"); if (d.getTime() > Date.now()) return message.error("economy/birthdate:DATE_TOO_HIGH"); - if (d.getTime() < (Date.now() - 2.523e+12))return message.error("economy/birthdate:DATE_TOO_LOW"); + if (d.getTime() < (Date.now() - 2.523e+12)) return message.error("economy/birthdate:DATE_TOO_LOW"); data.userData.birthdate = d; data.userData.save(); - message.success("economy/birthdate:SUCCESS", { date: message.printDate(d)}); + message.success("economy/birthdate:SUCCESS", { + date: message.printDate(d) + }); } }; diff --git a/commands/Economy/deposit.js b/commands/Economy/deposit.js index b54ba5bc..8626c370 100644 --- a/commands/Economy/deposit.js +++ b/commands/Economy/deposit.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Deposit extends Command { - constructor (client) { + constructor(client) { super(client, { name: "deposit", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "bank", "banque", "dep" ], + aliases: ["bank", "banque", "dep"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { let amount = args[0]; if (!(parseInt(data.memberData.money, 10) > 0)) return message.error("economy/deposit:NO_CREDIT"); @@ -34,7 +34,9 @@ class Deposit extends Command { data.memberData.bankSold = data.memberData.bankSold + amount; data.memberData.save(); - message.success("economy/deposit:SUCCESS", { money: amount }); + message.success("economy/deposit:SUCCESS", { + money: amount + }); } }; diff --git a/commands/Economy/divorce.js b/commands/Economy/divorce.js index aceda59b..6a82ad3b 100644 --- a/commands/Economy/divorce.js +++ b/commands/Economy/divorce.js @@ -1,37 +1,38 @@ const Command = require("../../base/Command.js"); class Divorce extends Command { - constructor (client) { + constructor(client) { super(client, { name: "divorce", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "profil" ], + aliases: ["profil"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { - // Check if the message author is wedded + async run(message, args, data) { if (!data.userData.lover) return message.error("economy/divorce:NOT_MARRIED"); - // Updates db const user = this.client.users.cache.get(data.userData.lover) || await this.client.users.fetch(data.userData.lover); data.userData.lover = null; data.userData.save(); - const oldLover = await this.client.findOrCreateUser({ id:user.id }); + const oldLover = await this.client.findOrCreateUser({ + id: user.id + }); oldLover.lover = null; oldLover.save(); - // Send success message - message.success("economy/divorce:DIVORCED", { username: user.username }); + message.success("economy/divorce:DIVORCED", { + username: user.username + }); } }; diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js index 9198de7c..e51fdc2a 100644 --- a/commands/Economy/leaderboard.js +++ b/commands/Economy/leaderboard.js @@ -2,48 +2,52 @@ const Command = require("../../base/Command.js"), AsciiTable = require("ascii-table"); class Leaderboard extends Command { - constructor (client) { + constructor(client) { super(client, { name: "leaderboard", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "lb" ], + aliases: ["lb"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args) { - const isOnlyOnMobile = (message.author.presence.clientStatus ? JSON.stringify(Object.keys(message.author.presence.clientStatus)) === JSON.stringify([ "mobile" ]) : false); + async run(message, args) { + const isOnlyOnMobile = (message.author.presence.clientStatus ? JSON.stringify(Object.keys(message.author.presence.clientStatus)) === JSON.stringify(["mobile"]) : false); const type = args[0]; if (!type || (type !== "credits" && type !== "level" && type !== "rep")) return message.error("economy/leaderboard:MISSING_TYPE"); if (type === "credits") { - const members = await this.client.membersData.find({ guildID: message.guild.id }).lean(), + const members = await this.client.membersData.find({ + guildID: message.guild.id + }).lean(), membersLeaderboard = members.map((m) => { return { id: m.id, value: m.money + m.bankSold }; - }).sort((a,b) => b.value - a.value); + }).sort((a, b) => b.value - a.value); const table = new AsciiTable("Таблица лидеров"); table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS")); if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; const newTable = await fetchUsers(membersLeaderboard, table, this.client); message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``); } else if (type === "level") { - const members = await this.client.membersData.find({ guildID: message.guild.id }).lean(), + const members = await this.client.membersData.find({ + guildID: message.guild.id + }).lean(), membersLeaderboard = members.map((m) => { return { id: m.id, value: m.level }; - }).sort((a,b) => b.value - a.value); + }).sort((a, b) => b.value - a.value); const table = new AsciiTable("Таблица лидеров"); table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL")); if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; @@ -56,7 +60,7 @@ class Leaderboard extends Command { id: u.id, value: u.rep }; - }).sort((a,b) => b.value - a.value); + }).sort((a, b) => b.value - a.value); const table = new AsciiTable("Таблица лидеров"); table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS")); if (usersLeaderboard.length > 20) usersLeaderboard.length = 20; diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js index c974be47..e061dadd 100644 --- a/commands/Economy/marry.js +++ b/commands/Economy/marry.js @@ -1,37 +1,42 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); -// An object to store pending requests const pendings = {}; class Marry extends Command { - constructor (client) { + constructor(client) { super(client, { name: "marry", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "mariage" ], + aliases: ["mariage"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args, data) { + async run(message, args, data) { // if the message author is already wedded - if (data.userData.lover) return message.error("economy/marry:ALREADY_MARRIED", { prefix: data.guild.prefix }); + if (data.userData.lover) return message.error("economy/marry:ALREADY_MARRIED", { + prefix: data.guild.prefix + }); // Gets the first mentionned member const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.error("economy/marry:INVALID_MEMBER"); - const userData = await this.client.findOrCreateUser({ id: member.id }); + const userData = await this.client.findOrCreateUser({ + id: member.id + }); // if the member is already wedded - if (userData.lover) return message.error("economy/marry:ALREADY_MARRIED_USER", { username: member.user.tag }); + if (userData.lover) return message.error("economy/marry:ALREADY_MARRIED_USER", { + username: member.user.tag + }); if (member.user.bot) return message.error("economy/marry:BOT_USER"); @@ -41,24 +46,37 @@ class Marry extends Command { const receiver = pendings[requester]; // If the member already sent a request to someone if (requester === message.author.id) { - const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver); - return message.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", { username: user.tag }); + const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver); + return message.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", { + username: user.tag + }); } else if (receiver === message.author.id) { // If there is a pending request for this member - const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester); - return message.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", { username: user.tag }); + const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester); + return message.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", { + username: user.tag + }); } else if (requester === member.id) { // If the asked member has sent pending request const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver); - return message.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", { firstUsername: member.user.tag, secondUsername: user.tag }); + return message.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", { + firstUsername: member.user.tag, + secondUsername: user.tag + }); } else if (receiver === member.id) { // If there is a pending request for the asked member const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester); - return message.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", { firstUsername: member.user.tag, secondUsername: user.tag }); + return message.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", { + firstUsername: member.user.tag, + secondUsername: user.tag + }); }; }; // Update pending requests pendings[message.author.id] = member.id; - message.sendT("economy/marry:REQUEST", { from: message.author.toString(), to: member.user.toString() }); + message.sendT("economy/marry:REQUEST", { + from: message.author.toString(), + to: member.user.toString() + }); const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === member.id, { time: 120000 @@ -78,7 +96,9 @@ class Marry extends Command { // Delete pending request delete pendings[message.author.id]; if (reason === "time") { - return message.error("economy/marry:TIMEOUT", { username: member.user.toString() }); + return message.error("economy/marry:TIMEOUT", { + username: member.user.toString() + }); }; if (reason) { data.userData.lover = member.id; @@ -87,12 +107,10 @@ class Marry extends Command { await userData.save(); const messageOptions = { content: `${member.toString()} :heart: ${message.author.toString()}`, - files: [ - { - name: "unlocked.png", - attachment: "./assets/img/achievements/achievement_unlocked3.png" - } - ] + files: [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked3.png" + }] }; let sent = false; if (!userData.achievements.married.achieved) { @@ -110,9 +128,15 @@ class Marry extends Command { data.userData.markModified("achievements.married"); data.userData.save(); }; - return message.success("economy/marry:SUCCESS", { creator: message.author.toString(), partner: member.user.toString() }); + return message.success("economy/marry:SUCCESS", { + creator: message.author.toString(), + partner: member.user.toString() + }); } else { - return message.success("economy/marry:DENIED", { creator: message.author.toString(), partner: member.user.toString() }); + return message.success("economy/marry:DENIED", { + creator: message.author.toString(), + partner: member.user.toString() + }); }; }); } diff --git a/commands/Economy/money.js b/commands/Economy/money.js index 527d56c9..0aff2799 100644 --- a/commands/Economy/money.js +++ b/commands/Economy/money.js @@ -8,42 +8,52 @@ const asyncForEach = async (array, callback) => { }; class Credits extends Command { - constructor (client) { + constructor(client) { super(client, { name: "money", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "credits", "balance" ], + aliases: ["credits", "balance"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { let member = await this.client.resolveMember(args[0], message.guild); if (!member) member = message.member; const user = member.user; if (user.bot) return message.error("misc:BOT_USER"); - const memberData = (message.author === user) ? data.memberData : await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }); + const memberData = (message.author === user) ? data.memberData : await this.client.findOrCreateMember({ + id: user.id, + guildID: message.guild.id + }); const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id)); let globalMoney = 0; await asyncForEach(commonsGuilds.array(), async (guild) => { - const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: guild.id }); - globalMoney+=memberData.money; - globalMoney+=memberData.bankSold; + const memberData = await this.client.findOrCreateMember({ + id: user.id, + guildID: guild.id + }); + globalMoney += memberData.money; + globalMoney += memberData.bankSold; }); const embed = new Discord.MessageEmbed() .setAuthor(message.translate("economy/money:TITLE", { username: member.user.username - }), member.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + }), member.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .addField(message.translate("economy/profile:CASH"), message.translate("economy/profile:MONEY", { money: memberData.money }), true) diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js index a1f53bde..72b88f66 100644 --- a/commands/Economy/pay.js +++ b/commands/Economy/pay.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Pay extends Command { - constructor (client) { + constructor(client) { super(client, { name: "pay", dirname: __dirname, @@ -9,29 +9,29 @@ class Pay extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args, data) { + async run(message, args, data) { const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.error("economy/pay:INVALID_MEMBER"); - if (member.user.bot) return message.error("economy/pay:BOT_USER"); - if (member.id === message.author.id) return message.error("economy/pay:YOURSELF"); const sentAmount = args[1]; if (!sentAmount || isNaN(sentAmount) || parseInt(sentAmount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT", { username: member.user.tag }); const amount = Math.ceil(parseInt(sentAmount, 10)); - if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", { amount, username: member.user.tag }); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); data.memberData.money = data.memberData.money - parseInt(amount, 10); data.memberData.save(); @@ -39,8 +39,10 @@ class Pay extends Command { memberData.money = memberData.money + parseInt(amount, 10); memberData.save(); - // Send a success message - message.success("economy/pay:SUCCESS", { amount, username: member.user.tag }); + message.success("economy/pay:SUCCESS", { + amount, + username: member.user.tag + }); } }; diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index 8f51318a..a7d9e60f 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -8,42 +8,45 @@ const asyncForEach = async (array, callback) => { }; class Profile extends Command { - constructor (client) { + constructor(client) { super(client, { name: "profile", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "profil" ], + aliases: ["profil"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const client = this.client; const arg = args[0] || message.author let member = await client.resolveMember(arg, message.guild); if (!member) member = message.member; - - // Check if the user is a bot if (member.user.bot) return message.error("economy/profile:BOT_USER"); - // Gets the data of the user whose profile you want to display - const memberData = (member.id === message.author.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildID: message.guild.id})); - const userData = (member.id === message.author.id ? data.userData : await client.findOrCreateUser({ id: member.id })); - - // Check if the lover is cached + const memberData = (member.id === message.author.id ? data.memberData : await client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + })); + const userData = (member.id === message.author.id ? data.userData : await client.findOrCreateUser({ + id: member.id + })); if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true); const commonsGuilds = client.guilds.cache.filter((g) => g.members.cache.get(member.id)); let globalMoney = 0; await asyncForEach(commonsGuilds.array(), async (guild) => { - const memberData = await client.findOrCreateMember({ id: member.id, guildID: guild.id }); + const memberData = await client.findOrCreateMember({ + id: member.id, + guildID: guild.id + }); globalMoney += memberData.money; globalMoney += memberData.bankSold; }); @@ -51,8 +54,15 @@ class Profile extends Command { const profileEmbed = new Discord.MessageEmbed() .setAuthor(message.translate("economy/profile:TITLE", { username: member.user.tag - }), member.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) - .attachFiles([{ attachment: await userData.getAchievements(), name: "achievements.png" }]) + }), member.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) + .attachFiles([{ + attachment: await userData.getAchievements(), + name: "achievements.png" + }]) .setImage("attachment://achievements.png") // .setDescription(userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) .addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) @@ -71,7 +81,7 @@ class Profile extends Command { .addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true) .addField(message.translate("economy/profile:EXP"), `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, true) .addField(message.translate("economy/profile:REGISTERED"), message.printDate(new Date(memberData.registeredAt)), true) - .addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE"): message.printDate(new Date(userData.birthdate))), true) + .addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : message.printDate(new Date(userData.birthdate))), true) .addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true) .addField(message.translate("economy/profile:ACHIEVEMENTS"), message.translate("economy/profile:ACHIEVEMENTS_CONTENT", { prefix: data.guild.prefix diff --git a/commands/Economy/rep.js b/commands/Economy/rep.js index a11b0e34..2a8f2d5a 100644 --- a/commands/Economy/rep.js +++ b/commands/Economy/rep.js @@ -1,29 +1,33 @@ const Command = require("../../base/Command.js"); class Rep extends Command { - constructor (client) { + constructor(client) { super(client, { name: "rep", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "reputation" ], + aliases: ["reputation"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { // if the member is already in the cooldown db - const isInCooldown = (data.userData.cooldowns || { rep: 0 }).rep; + const isInCooldown = (data.userData.cooldowns || { + rep: 0 + }).rep; if (isInCooldown) { /*if the timestamp recorded in the database indicating when the member will be able to execute the order again is greater than the current date, display an error message */ - if (isInCooldown > Date.now()) return message.error("economy/rep:COOLDOWN", { time: message.convertTime(isInCooldown, "to", true) }); + if (isInCooldown > Date.now()) return message.error("economy/rep:COOLDOWN", { + time: message.convertTime(isInCooldown, "to", true) + }); }; const user = await this.client.resolveUser(args[0]); @@ -38,19 +42,28 @@ class Rep extends Command { data.userData.markModified("cooldowns"); data.userData.save(); - const userData = await this.client.findOrCreateUser({ id: user.id }); + const userData = await this.client.findOrCreateUser({ + id: user.id + }); userData.rep++; if (!userData.achievements.rep.achieved) { userData.achievements.rep.progress.now = (userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep); if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) { userData.achievements.rep.achieved = true; - message.channel.send({ files: [ { name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked6.png"}]}); + message.channel.send({ + files: [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked6.png" + }] + }); }; userData.markModified("achievements.rep"); }; await userData.save(); - message.success("economy/rep:SUCCESS", { username: user.username }); + message.success("economy/rep:SUCCESS", { + username: user.username + }); } }; diff --git a/commands/Economy/rob.js b/commands/Economy/rob.js index 5e3c8542..8d24e62d 100644 --- a/commands/Economy/rob.js +++ b/commands/Economy/rob.js @@ -1,42 +1,55 @@ const Command = require("../../base/Command.js"); class Rob extends Command { - constructor (client) { + constructor(client) { super(client, { name: "rob", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "steal" ], + aliases: ["steal"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args, data) { + async run(message, args, data) { const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.error("economy/rob:MISSING_MEMBER"); if (member.id === message.author.id) return message.error("economy/rob:YOURSELF"); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); const isInCooldown = memberData.cooldowns.rob || 0; if (isInCooldown) { - if (isInCooldown > Date.now()) return message.error("economy/rob:COOLDOWN", { username: member.user.tag }); + if (isInCooldown > Date.now()) return message.error("economy/rob:COOLDOWN", { + username: member.user.tag + }); }; let amountToRob = args[1]; - if (!amountToRob || isNaN(amountToRob) || parseInt(amountToRob, 10) <= 0) return message.error("economy/rob:MISSING_AMOUNT", { username: member.user.username }); + if (!amountToRob || isNaN(amountToRob) || parseInt(amountToRob, 10) <= 0) return message.error("economy/rob:MISSING_AMOUNT", { + username: member.user.username + }); amountToRob = Math.floor(parseInt(amountToRob, 10)); - if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", { username: member.user.username, money: amountToRob }); + if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", { + username: member.user.username, + money: amountToRob + }); const potentiallyLose = Math.floor(amountToRob * 1.5); - if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", { moneyMin: potentiallyLose, moneyCurrent: data.memberData.money }); + if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", { + moneyMin: potentiallyLose, + moneyCurrent: data.memberData.money + }); const itsAWon = Math.floor(this.client.functions.randomNum(0, 100) < 25); @@ -46,7 +59,10 @@ class Rob extends Command { memberData.markModified("cooldowns"); await memberData.save(); const randomNum = Math.floor(this.client.functions.randomNum(1, 3)); - message.sendT("economy/rob:ROB_WON_" + randomNum, { money: amountToRob, username: member.user.username }); + message.sendT("economy/rob:ROB_WON_" + randomNum, { + money: amountToRob, + username: member.user.username + }); data.memberData.money += amountToRob; memberData.money -= amountToRob, 10; memberData.save(); @@ -54,7 +70,11 @@ class Rob extends Command { } else { const won = Math.floor(0.9 * amountToRob); const randomNum = Math.floor(this.client.functions.randomNum(1, 3)); - message.sendT("economy/rob:ROB_LOSE_" + randomNum, { fine: potentiallyLose, offset: won, username: member.user.username }); + message.sendT("economy/rob:ROB_LOSE_" + randomNum, { + fine: potentiallyLose, + offset: won, + username: member.user.username + }); data.memberData.money -= potentiallyLose; memberData.money += won; memberData.save(); diff --git a/commands/Economy/setbio.js b/commands/Economy/setbio.js index fee1a1b2..037d5f5d 100644 --- a/commands/Economy/setbio.js +++ b/commands/Economy/setbio.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Setbio extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setbio", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "biography", "setdesc" ], + aliases: ["biography", "setdesc"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const newBio = args.join(" "); if (!newBio) return message.error("economy/setbio:MISSING"); if (newBio.length > 100) return message.error("economy/setbio:MAX_CHARACT"); diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js index 24d80e74..d94229c1 100644 --- a/commands/Economy/slots.js +++ b/commands/Economy/slots.js @@ -1,27 +1,27 @@ const Command = require("../../base/Command.js"); class Slots extends Command { - constructor (client) { + constructor(client) { super(client, { name: "slots", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "casino", "slot" ], + aliases: ["casino", "slot"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { - const fruits = [ "🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓" ]; + async run(message, args, data) { + const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"]; - let i1=0, j1=0, k1=0, - i2=1, j2=1, k2=1, - i3=2, j3=2, k3=2; + let i1 = 0, j1 = 0, k1 = 0, + i2 = 1, j2 = 1, k2 = 1, + i3 = 2, j3 = 2, k3 = 2; // Gets three random fruits array const colonnes = [ @@ -33,7 +33,6 @@ class Slots extends Command { // Gets the amount provided let amount = args[0]; if (!amount || isNaN(amount) || amount < 1) amount = 1; - if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", { money: amount }); amount = Math.round(amount); @@ -47,7 +46,9 @@ class Slots extends Command { return Math.round(number); }; - const tmsg = await message.sendT("misc:loading", null, { prefixEmoji: "loading" }); + const tmsg = await message.sendT("misc:loading", null, { + prefixEmoji: "loading" + }); editMsg(); const interval = setInterval(editMsg, 1000); setTimeout(() => { @@ -56,7 +57,7 @@ class Slots extends Command { }, 4000); async function end() { - let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n"; + let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n"; i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0; i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0; @@ -76,14 +77,23 @@ class Slots extends Command { msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |"; tmsg.edit(msg); const credits = getCredits(amount, true); - message.channel.send("**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", { money: amount, won: credits, username: message.author.username })); + message.channel.send("**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", { + money: amount, + won: credits, + username: message.author.username + })); const toAdd = credits - amount; data.memberData.money = data.memberData.money + toAdd; if (!data.userData.achievements.slots.achieved) { data.userData.achievements.slots.progress.now += 1; if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { data.userData.achievements.slots.achieved = true; - message.channel.send({ files: [ { name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked4.png" } ] }); + message.channel.send({ + files: [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked4.png" + }] + }); }; data.userData.markModified("achievements.slots"); await data.userData.save(); @@ -107,7 +117,12 @@ class Slots extends Command { data.userData.achievements.slots.progress.now += 1; if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { data.userData.achievements.slots.achieved = true; - message.channel.send({ files: [ { name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked4.png" } ] }); + message.channel.send({ + files: [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked4.png" + }] + }); }; data.userData.markModified("achievements.slots"); await data.userData.save(); @@ -132,7 +147,7 @@ class Slots extends Command { }; function editMsg() { - let msg = "[ :slot_machine: l SLOTS ]\n------------------\n"; + let msg = "[ :slot_machine: l SLOTS ]\n------------------\n"; i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0; i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0; @@ -144,9 +159,9 @@ class Slots extends Command { k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0; k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0; - msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : "+ colonnes[2][k1] + "\n"; - msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : "+ colonnes[2][k2] + " **<**\n"; - msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : "+ colonnes[2][k3] + "\n"; + msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : " + colonnes[2][k1] + "\n"; + msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n"; + msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n"; tmsg.edit(msg); }; diff --git a/commands/Economy/withdraw.js b/commands/Economy/withdraw.js index 5e95b9b4..e61f9199 100644 --- a/commands/Economy/withdraw.js +++ b/commands/Economy/withdraw.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Withdraw extends Command { - constructor (client) { + constructor(client) { super(client, { name: "withdraw", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "wd" ], + aliases: ["wd"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { let amount = args[0]; if (!(parseInt(data.memberData.bankSold, 10) > 0)) return message.error("economy/withdraw:NO_CREDIT"); @@ -25,7 +25,7 @@ class Withdraw extends Command { if (args[0] === "all") { amount = parseInt(data.memberData.bankSold, 10); } else { - if (isNaN(amount) || parseInt(amount, 10) < 1)return message.error("economy/withdraw:MISSING_AMOUNT"); + if (isNaN(amount) || parseInt(amount, 10) < 1) return message.error("economy/withdraw:MISSING_AMOUNT"); amount = parseInt(amount, 10); }; @@ -35,7 +35,9 @@ class Withdraw extends Command { data.memberData.bankSold = data.memberData.bankSold - amount; data.memberData.save(); - message.success("economy/withdraw:SUCCESS", { money: amount }); + message.success("economy/withdraw:SUCCESS", { + money: amount + }); } }; diff --git a/commands/Economy/work.js b/commands/Economy/work.js index d0c83af4..1373650f 100644 --- a/commands/Economy/work.js +++ b/commands/Economy/work.js @@ -2,29 +2,31 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Work extends Command { - constructor (client) { + constructor(client) { super(client, { name: "work", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "salaire", "salary", "travail", "daily", "dailies" ], + aliases: ["salaire", "salary", "travail", "daily", "dailies"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { // if the member is already in the cooldown db const isInCooldown = data.memberData.cooldowns.work; if (isInCooldown) { /*if the timestamp recorded in the database indicating when the member will be able to execute the order again is greater than the current date, display an error message */ - if (isInCooldown > Date.now()) return message.error("economy/work:COOLDOWN", { time: message.convertTime(isInCooldown, "to", true) }); + if (isInCooldown > Date.now()) return message.error("economy/work:COOLDOWN", { + time: message.convertTime(isInCooldown, "to", true) + }); }; if (Date.now() > data.memberData.cooldowns.work + (24 * 3600000)) data.memberData.workStreak = 0; @@ -38,7 +40,11 @@ class Work extends Command { await data.memberData.save(); const embed = new Discord.MessageEmbed() - .setFooter(message.translate("economy/work:AWARD"), message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setFooter(message.translate("economy/work:AWARD"), message.author.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setColor(data.config.embed.color); const award = [ @@ -52,7 +58,9 @@ class Work extends Command { if (data.memberData.workStreak >= 5) { won += 200; - embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { won })) + embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { + won + })) .addField(message.translate("economy/work:STREAK"), message.translate("economy/work:STREAK_CONTENT")); data.memberData.workStreak = 0; } else { @@ -62,23 +70,25 @@ class Work extends Command { award[i] = `:regional_indicator_${letter.toLowerCase()}:`; }; }; - embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { won })) + embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { + won + })) .addField(message.translate("economy/work:STREAK"), award.join("")); }; data.memberData.money = data.memberData.money + won; data.memberData.save(); - const messageOptions = { embed }; + const messageOptions = { + embed + }; if (!data.userData.achievements.work.achieved) { data.userData.achievements.work.progress.now += 1; if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) { - messageOptions.files = [ - { - name: "unlocked.png", - attachment: "./assets/img/achievements/achievement_unlocked1.png" - } - ]; + messageOptions.files = [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked1.png" + }]; data.userData.achievements.work.achieved = true; }; data.userData.markModified("achievements.work"); diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js index 24955cff..390e7f28 100644 --- a/commands/Fun/8ball.js +++ b/commands/Fun/8ball.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Eightball extends Command { - constructor (client) { + constructor(client) { super(client, { name: "8ball", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "eight-ball", "eightball" ], + aliases: ["eight-ball", "eightball"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { if (!args[0] || !message.content.endsWith("?")) return message.error("fun/8ball:ERR_QUESTION"); const answerNO = parseInt(Math.floor(Math.random() * 10), 10); diff --git a/commands/Fun/ascii.js b/commands/Fun/ascii.js index b7d44f91..34d3ff0b 100644 --- a/commands/Fun/ascii.js +++ b/commands/Fun/ascii.js @@ -4,7 +4,7 @@ const Command = require("../../base/Command.js"), figletAsync = util.promisify(figlet); class Ascii extends Command { - constructor (client) { + constructor(client) { super(client, { name: "ascii", dirname: __dirname, @@ -12,18 +12,20 @@ class Ascii extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { const text = args.join(" "); if (!text || text.length > 20) return message.error("fun/ascii:TEXT_MISSING"); const rendered = await figletAsync(text); + if (!rendered) rendered = await figletAsync("Nothing"); + message.channel.send("```" + rendered + "```"); } }; diff --git a/commands/Fun/choice.js b/commands/Fun/choice.js index 53a77c3a..f0f0df91 100644 --- a/commands/Fun/choice.js +++ b/commands/Fun/choice.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Choice extends Command { - constructor (client) { + constructor(client) { super(client, { name: "choice", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "random" ], + aliases: ["random"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { // Gets the answers by spliting on "/" const answers = args.join(" ").split("/"); if (answers.length < 2) return message.error("fun/choice:MISSING"); @@ -25,7 +25,9 @@ class Choice extends Command { const m = await message.sendT("fun/choice:PROGRESS", null, false, false, "loading"); setTimeout(() => { - m.success("fun/choice:DONE", null, { edit: true }); + m.success("fun/choice:DONE", null, { + edit: true + }); const result = answers[parseInt(Math.floor(Math.random() * answers.length))]; message.channel.send("```" + result + "```"); }, 1500); diff --git a/commands/Fun/findwords.js b/commands/Fun/findwords.js index cc61039b..c1bfa30e 100644 --- a/commands/Fun/findwords.js +++ b/commands/Fun/findwords.js @@ -4,7 +4,7 @@ const Command = require("../../base/Command.js"), const currentGames = {}; class FindWords extends Command { - constructor (client) { + constructor(client) { super(client, { name: "findwords", dirname: __dirname, @@ -12,14 +12,14 @@ class FindWords extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING"); // Reads words file @@ -55,7 +55,9 @@ class FindWords extends Command { setTimeout(() => { // Send announcment message - message.sendT("fun/findwords:FIND_WORD", { word }, false, false, "warn"); + message.sendT("fun/findwords:FIND_WORD", { + word + }, false, false, "warn"); // init a collector to receive the answers const collector = new Discord.MessageCollector(message.channel, (m) => !m.author.bot, { @@ -69,7 +71,9 @@ class FindWords extends Command { if (msg.content.toLowerCase().indexOf(word) >= 0 && wordList.map((word) => word.toLowerCase()).indexOf(msg.content.toLowerCase()) >= 0) { collector.stop(msg.author.id); // Stop the collector } else { - msg.error("fun/findwords:INVALID_WORD", { member: msg.author.toString() }); + msg.error("fun/findwords:INVALID_WORD", { + member: msg.author.toString() + }); }; }); @@ -77,7 +81,9 @@ class FindWords extends Command { if (reason === "time") { message.error("fun/findwords:NO_WINNER"); } else { - message.success("fun/findwords:WORD_FOUND", { winner: `<@${reason}>` }); + message.success("fun/findwords:WORD_FOUND", { + winner: `<@${reason}>` + }); winners.push(reason); } if (i < nbGames - 1) { @@ -97,8 +103,13 @@ class FindWords extends Command { participantList: participants.map((p) => `<@${p}>`).join("\n") }); if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) { - message.sendT("fun/findwords:CREDITS", { winner: user.username }); - const userdata = await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }); + message.sendT("fun/findwords:CREDITS", { + winner: user.username + }); + const userdata = await this.client.findOrCreateMember({ + id: user.id, + guildID: message.guild.id + }); userdata.money = userdata.money + 15; userdata.save(); }; diff --git a/commands/Fun/flip.js b/commands/Fun/flip.js index 18655785..f2323922 100644 --- a/commands/Fun/flip.js +++ b/commands/Fun/flip.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Flip extends Command { - constructor (client) { + constructor(client) { super(client, { name: "flip", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "dice", "coin" ], + aliases: ["dice", "coin"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message) { + async run(message) { const isHeads = Math.random() > 0.5; isHeads ? message.sendT("fun/flip:HEADS") : message.sendT("fun/flip:TAILS"); } diff --git a/commands/Fun/fml.js b/commands/Fun/fml.js index c7b8c3b7..9f31b8eb 100644 --- a/commands/Fun/fml.js +++ b/commands/Fun/fml.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Fml extends Command { - constructor (client) { + constructor(client) { super(client, { name: "fml", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "vdm" ], + aliases: ["vdm"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED"); // const fml = await this.client.joker.randomVDM(null, data.guild.language.substr(0, 2)); diff --git a/commands/Fun/joke.js b/commands/Fun/joke.js index 5c783452..1ef31e34 100644 --- a/commands/Fun/joke.js +++ b/commands/Fun/joke.js @@ -2,26 +2,26 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Joke extends Command { - constructor (client) { + constructor(client) { super(client, { name: "joke", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "blague" ], + aliases: ["blague"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED"); // const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2)); - const joke = await this.client.joker.randomJoke("en"); + const joke = await this.client.joker.randomJoke("en"); const embed = new Discord.MessageEmbed() .setDescription(joke.toDiscordSpoils()) diff --git a/commands/Fun/lmg.js b/commands/Fun/lmg.js index ee738225..5bd1207f 100644 --- a/commands/Fun/lmg.js +++ b/commands/Fun/lmg.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Lmg extends Command { - constructor (client) { + constructor(client) { super(client, { name: "lmg", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "lmgtfy" ], + aliases: ["lmgtfy"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args) { + async run(message, args) { const question = args.join(" "); if (!question) return message.error("fun/lmg:MISSING"); const encodedQuestion = question.replace(/[' '_]/g, "+"); diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js index 75d07800..09011624 100644 --- a/commands/Fun/lovecalc.js +++ b/commands/Fun/lovecalc.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), md5 = require("md5"); class Lovecalc extends Command { - constructor (client) { + constructor(client) { super(client, { name: "lovecalc", dirname: __dirname, @@ -11,14 +11,14 @@ class Lovecalc extends Command { guildOnly: true, aliases: ["lc"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message) { + async run(message) { const firstMember = message.mentions.members.filter(m => m.id !== message.author.id).first(); if (!firstMember) return message.error("fun/lovecalc:MISSING"); const secondMember = message.mentions.members @@ -37,8 +37,12 @@ class Lovecalc extends Command { const percent = parseInt(string.substr(0, 2), 10); const embed = new Discord.MessageEmbed() - .setAuthor("❤️ LoveCalc") - .setDescription(message.translate("fun/lovecalc:CONTENT", { percent, firstUsername: firstMember.user.username, secondUsername: secondMember.user.username })) + .setAuthor(`❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`) + .setDescription(message.translate("fun/lovecalc:CONTENT", { + percent, + firstUsername: firstMember.user.username, + secondUsername: secondMember.user.username + })) .setColor(this.client.config.embed.color) .setFooter(this.client.config.embed.footer); diff --git a/commands/Fun/number.js b/commands/Fun/number.js index 78af9eae..975f302b 100644 --- a/commands/Fun/number.js +++ b/commands/Fun/number.js @@ -4,7 +4,7 @@ const Command = require("../../base/Command.js"), const currentGames = {}; class Number extends Command { - constructor (client) { + constructor(client) { super(client, { name: "number", dirname: __dirname, @@ -12,14 +12,14 @@ class Number extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message) { + async run(message) { if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING"); const participants = []; @@ -38,28 +38,46 @@ class Number extends Command { collector.on("collect", async msg => { if (!participants.includes(msg.author.id)) participants.push(msg.author.id); - // if it's not a number, return if (isNaN(msg.content)) return; const parsedNumber = parseInt(msg.content, 10); if (parsedNumber === number) { const time = this.client.functions.convertTime(message.guild, Date.now() - gameCreatedAt); - message.sendT("fun/number:GAME_STATS", { winner: msg.author.toString(), number, time, participantCount: participants.length, participants: participants.map(p => `<@${p}>`).join("\n") }); - message.sendT("fun/number:WON", { winner: msg.author.toString() }); - const userdata = await this.client.findOrCreateMember({ id: msg.author.id, guildID: message.guild.id }); + message.sendT("fun/number:GAME_STATS", { + winner: msg.author.toString(), + number, + time, + participantCount: participants.length, + participants: participants.map(p => `<@${p}>`).join("\n") + }); + message.sendT("fun/number:WON", { + winner: msg.author.toString() + }); + const userdata = await this.client.findOrCreateMember({ + id: msg.author.id, + guildID: message.guild.id + }); userdata.money = userdata.money + 10; userdata.save(); collector.stop(msg.author.username); }; - if (parseInt(msg.content) < number) message.error("fun/number:BIG", { user: msg.author.toString(), number: parsedNumber }); - if (parseInt(msg.content) > number) message.error("fun/number:SMALL", { user: msg.author.toString(), number: parsedNumber }); + if (parseInt(msg.content) < number) message.error("fun/number:BIG", { + user: msg.author.toString(), + number: parsedNumber + }); + if (parseInt(msg.content) > number) message.error("fun/number:SMALL", { + user: msg.author.toString(), + number: parsedNumber + }); }); collector.on("end", (_collected, reason) => { delete currentGames[message.guild.id]; if (reason === "time") { - return message.error("fun/number:DEFEAT", { number }); + return message.error("fun/number:DEFEAT", { + number + }); }; }); } diff --git a/commands/General/activity.js b/commands/General/activity.js index 30e3888d..ea67d656 100644 --- a/commands/General/activity.js +++ b/commands/General/activity.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Activity extends Command { - constructor (client) { + constructor(client) { super(client, { name: "activity", dirname: __dirname, @@ -10,14 +10,14 @@ class Activity extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); @@ -38,7 +38,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "betrayal": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "betrayal").then(async invite => { @@ -50,7 +50,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "checkers": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "checkers").then(async invite => { @@ -62,7 +62,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "chess": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "chess").then(async invite => { @@ -74,7 +74,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "doodlecrew": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "doodlecrew").then(async invite => { @@ -86,7 +86,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "fishing": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "fishing").then(async invite => { @@ -98,7 +98,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "lettertile": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "lettertile").then(async invite => { @@ -110,7 +110,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "poker": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "poker").then(async invite => { @@ -122,7 +122,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "spellcast": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "spellcast").then(async invite => { @@ -134,7 +134,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "wordsnack": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "wordsnack").then(async invite => { @@ -146,7 +146,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "puttparty": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "puttparty").then(async invite => { @@ -158,7 +158,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; case "youtube": this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "youtube").then(async invite => { @@ -170,7 +170,7 @@ class Activity extends Command { .setTimestamp() return message.channel.send(embed); }); - break; + break; default: const embed = new Discord.MessageEmbed() @@ -180,7 +180,7 @@ class Activity extends Command { .setFooter(message.translate("general/activity:FOOTER")) .setTimestamp() message.channel.send(embed); - break; + break; }; } }; diff --git a/commands/General/fortnite.js b/commands/General/fortnite.js index 55232872..273ec817 100644 --- a/commands/General/fortnite.js +++ b/commands/General/fortnite.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Fortnite extends Command { - constructor (client) { + constructor(client) { super(client, { name: "fortnite", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "fn" ], + aliases: ["fn"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { if (!data.config.apiKeys.fortniteTRN || data.config.apiKeys.fortniteTRN.length === "") return message.success("misc:COMMAND_DISABLED"); const stats = new Canvas.FortniteStats(); @@ -29,7 +29,9 @@ class Fortnite extends Command { const user = args.slice(1).join(" "); if (!user) return message.error("general/fortnite:MISSING_USERNAME"); - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); const statsImage = await stats .setToken(data.config.apiKeys.fortniteTRN) @@ -51,17 +53,22 @@ class Fortnite extends Command { if (!statsImage) { m.delete(); - return message.error("general/fortnite:NOT_FOUND", { platform, search: user }); + return message.error("general/fortnite:NOT_FOUND", { + platform, + search: user + }); }; // Send embed const attachment = new Discord.MessageAttachment(statsImage.toBuffer(), "fortnite-stats-image.png"), embed = new Discord.MessageEmbed() - .setDescription(message.translate("general/fortnite:TITLE", { username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})` })) - .attachFiles(attachment) - .setImage("attachment://fortnite-stats-image.png") - .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setDescription(message.translate("general/fortnite:TITLE", { + username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})` + })) + .attachFiles(attachment) + .setImage("attachment://fortnite-stats-image.png") + .setColor(data.config.embed.color) + .setFooter(data.config.embed.footer); message.channel.send(embed); m.delete(); } diff --git a/commands/General/fortniteshop.js b/commands/General/fortniteshop.js index 89a8f36e..ac762930 100644 --- a/commands/General/fortniteshop.js +++ b/commands/General/fortniteshop.js @@ -3,15 +3,15 @@ const Command = require("../../base/Command.js"), Canvas = require("discord-canvas"); class Fortniteshop extends Command { - constructor (client) { + constructor(client) { super(client, { name: "fortniteshop", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "fnshop" ], + aliases: ["fnshop"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 @@ -21,7 +21,9 @@ class Fortniteshop extends Command { async run(message, args, data) { if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED"); - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment; const shop = new Canvas.FortniteShop(); @@ -30,14 +32,22 @@ class Fortniteshop extends Command { .setText("header", message.translate("general/fortniteshop:HEADER")) .setText("daily", message.translate("general/fortniteshop:DAILY")) .setText("featured", message.translate("general/fortniteshop:FEATURED")) - .setText("date", message.translate("general/fortniteshop:DATE", { skipInterpolation: true }).replace("{{date}}", "{date}")) + .setText("date", message.translate("general/fortniteshop:DATE", { + skipInterpolation: true + }).replace("{{date}}", "{date}")) .setText("footer", message.translate("general/fortniteshop:FOOTER")) .lang(momentName) .toAttachment(); const attachment = new Discord.MessageAttachment(image, "shop.png"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/fortniteshop:HEADER", { date: message.printDate(new Date(Date.now())) }), this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(message.translate("general/fortniteshop:HEADER", { + date: message.printDate(new Date(Date.now())) + }), this.client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .attachFiles(attachment) .setImage("attachment://shop.png") .setColor(this.client.config.embed.color) diff --git a/commands/General/github.js b/commands/General/github.js index a5bdcf0f..dd6a60d5 100644 --- a/commands/General/github.js +++ b/commands/General/github.js @@ -3,27 +3,33 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Github extends Command { - constructor (client) { + constructor(client) { super(client, { name: "github", dirname: __dirname, enabled: false, guildOnly: false, - aliases: [ "git", "code" ], + aliases: ["git", "code"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { - const res = await fetch("https://api.github.com/repos/JonnyBro/JaBa-new"); + async run(message, args, data) { + const res = await fetch("https://api.github.com/repos/JonnyBro/JaBa-new", { + headers: `Authorization: ${this.config.githubToken}` + }); const json = await res.json(); const embed = new Discord.MessageEmbed() - .setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setDescription(`[${message.translate("general/github:CLICK_HERE")}](https://github.com/JonnyBro/JaBa-new)`) .addField("Stars", json.stargazers_count, true) .addField("Forks", json.forks_count, true) diff --git a/commands/General/hastebin.js b/commands/General/hastebin.js index 09d29d61..f42be0d5 100644 --- a/commands/General/hastebin.js +++ b/commands/General/hastebin.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Hastebin extends Command { - constructor (client) { + constructor(client) { super(client, { name: "hastebin", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "pastebin" ], + aliases: ["pastebin"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const content = args.join(" "); if (!content) return message.error("general/hastebin:MISSING_TEXT"); @@ -26,7 +26,9 @@ class Hastebin extends Command { const res = await fetch("https://hastebin.com/documents", { method: "POST", body: content, - headers: { "Content-Type": "text/plain" } + headers: { + "Content-Type": "text/plain" + } }); const json = await res.json(); @@ -39,7 +41,7 @@ class Hastebin extends Command { .setDescription(url) .setColor(data.config.embed.color); message.channel.send(embed); - } catch(e) { + } catch (e) { message.error("misc:ERR_OCCURRED"); }; } diff --git a/commands/General/help.js b/commands/General/help.js index eded25c3..eb8c122f 100644 --- a/commands/General/help.js +++ b/commands/General/help.js @@ -2,41 +2,49 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Help extends Command { - constructor (client) { + constructor(client) { super(client, { name: "help", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "aide", "h", "commands" ], + aliases: ["aide", "h", "commands"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { - // if a command is provided + async run(message, args, data) { if (args[0]) { const isCustom = (message.guild && data.guild.customCommands ? data.guild.customCommands.find((c) => c.name === args[0]) : false); - // if the command doesn't exist, error message const cmd = this.client.commands.get(args[0]) || this.client.commands.get(this.client.aliases.get(args[0])); if (!cmd && isCustom) { - return message.error("general/help:CUSTOM", { cmd: args[0] }); + return message.error("general/help:CUSTOM", { + cmd: args[0] + }); } else if (!cmd) { - return message.error("general/help:NOT_FOUND", { search: args[0] }); + return message.error("general/help:NOT_FOUND", { + search: args[0] + }); }; const description = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:DESCRIPTION`); - const usage = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`, { prefix: message.guild ? data.guild.prefix : "" }); - const examples = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:EXAMPLES`, { prefix: message.guild ? data.guild.prefix : "" }); + const usage = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`, { + prefix: message.guild ? data.guild.prefix : "" + }); + const examples = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:EXAMPLES`, { + prefix: message.guild ? data.guild.prefix : "" + }); - // Creates the help embed const groupEmbed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/help:CMD_TITLE", { prefix: message.guild ? data.guild.prefix : "", cmd: cmd.help.name })) + .setAuthor(message.translate("general/help:CMD_TITLE", { + prefix: message.guild ? data.guild.prefix : "", + cmd: cmd.help.name + })) .addField(message.translate("general/help:FIELD_DESCRIPTION"), description) .addField(message.translate("general/help:FIELD_USAGE"), usage) .addField(message.translate("general/help:FIELD_EXAMPLES"), examples) @@ -45,7 +53,6 @@ class Help extends Command { .setColor(this.client.config.embed.color) .setFooter(this.client.config.embed.footer); - // and send the embed in the current channel return message.channel.send(groupEmbed); }; @@ -62,7 +69,9 @@ class Help extends Command { const emojis = this.client.customEmojis; const embed = new Discord.MessageEmbed() - .setDescription(message.translate("general/help:INFO", { prefix: message.guild ? data.guild.prefix : "" })) + .setDescription(message.translate("general/help:INFO", { + prefix: message.guild ? data.guild.prefix : "" + })) .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); categories.sort().forEach((cat) => { @@ -78,7 +87,13 @@ class Help extends Command { donateLink: "https://qiwi.com/n/JONNYBRO", owner: this.client.config.owner.id })); - embed.setAuthor(message.translate("general/help:TITLE", { name: this.client.user.username }), this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })); + embed.setAuthor(message.translate("general/help:TITLE", { + name: this.client.user.username + }), this.client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })); return message.channel.send(embed); } }; diff --git a/commands/General/invitations.js b/commands/General/invitations.js index f9ce9335..3a65af68 100644 --- a/commands/General/invitations.js +++ b/commands/General/invitations.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Invitations extends Command { - constructor (client) { + constructor(client) { super(client, { name: "invitations", dirname: __dirname, @@ -10,18 +10,17 @@ class Invitations extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "MANAGE_GUILD" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_GUILD"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { let member = await this.client.resolveMember(args[0], message.guild); if (!member) member = message.member; - // Gets the invites const invites = await message.guild.fetchInvites().catch(() => {}); if (!invites) return message.error("misc:ERR_OCCURRED"); @@ -31,12 +30,18 @@ class Invitations extends Command { if (member === message.member) { return message.error("general/invitations:NOBODY_AUTHOR"); } else { - return message.error("general/invitations:NOBODY_MEMBER", { member: member.user.tag }); + return message.error("general/invitations:NOBODY_MEMBER", { + member: member.user.tag + }); }; }; const content = memberInvites.map((i) => { - return message.translate("general/invitations:CODE", { uses: i.uses, code: i.code, channel: i.channel.toString() }); + return message.translate("general/invitations:CODE", { + uses: i.uses, + code: i.code, + channel: i.channel.toString() + }); }).join("\n"); let index = 0; memberInvites.forEach((invite) => index += invite.uses); diff --git a/commands/General/invite.js b/commands/General/invite.js index 3814b6b9..6ddfd855 100644 --- a/commands/General/invite.js +++ b/commands/General/invite.js @@ -2,31 +2,33 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Invite extends Command { - constructor (client) { + constructor(client) { super(client, { name: "invite", dirname: __dirname, enabled: false, guildOnly: false, - aliases: [ "i", "add", "vote" ], + aliases: ["i", "add", "vote"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { - const inviteLink = this.client.config.inviteURL || `https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`; - const voteURL = this.client.config.voteURL || `https://discordbots.org/bot/${this.client.user.id}/vote`; - const supportURL = this.client.config.supportURL || await this.client.functions.supportLink(this.client); + async run(message, args, data) { + const inviteLink = `https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`; + const voteURL = `https://discordbots.org/bot/${this.client.user.id}/vote`; + const supportURL = await this.client.functions.supportLink(this.client); if (args[0] && args[0] === "copy") return message.channel.send(inviteLink); const embed = new Discord.MessageEmbed() .setAuthor(message.translate("general/invite:LINKS")) - .setDescription(message.translate("general/invite:TIP", { prefix: data.guild.prefix || "" })) + .setDescription(message.translate("general/invite:TIP", { + prefix: data.guild.prefix || "" + })) .addField(message.translate("general/invite:ADD"), inviteLink) .addField(message.translate("general/invite:VOTE"), voteURL) .addField(message.translate("general/invite:SUPPORT"), supportURL) diff --git a/commands/General/minecraft.js b/commands/General/minecraft.js index d7f4c4ee..e274ee42 100644 --- a/commands/General/minecraft.js +++ b/commands/General/minecraft.js @@ -5,22 +5,22 @@ const Command = require("../../base/Command.js"), Sentry = require("@sentry/node"); class Minecraft extends Command { - constructor (client) { + constructor(client) { super(client, { name: "minecraft", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "mc" ], + aliases: ["mc"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const ip = args[0]; if (!ip) return message.error("general/minecraft:MISSING_IP"); @@ -31,7 +31,7 @@ class Minecraft extends Command { }; if (ip.split(":").length > 1) { - const ip = ip.split(":") + const ip = ip.split(":"); options = { type: "minecraft", host: ip[0], @@ -39,7 +39,9 @@ class Minecraft extends Command { }; }; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); let json = null; @@ -64,17 +66,23 @@ class Minecraft extends Command { const imgAttachment = new Discord.MessageAttachment(await imgRes.buffer(), "success.png"); const mcEmbed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/minecraft:FIELD_NAME", { ip: json.name })) + .setAuthor(message.translate("general/minecraft:FIELD_NAME", { + ip: json.name + })) .addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name) - .addField(message.translate("general/minecraft:FIELD_CONNECTED"), message.translate("general/minecraft:PLAYERS", { count: (json.raw.players ? json.raw.players.online : json.players.length) })) - .addField(message.translate("general/minecraft:FIELD_MAX"), message.translate("general/minecraft:PLAYERS", { count: (json.raw.players ? json.raw.players.max : json.maxplayers) })) + .addField(message.translate("general/minecraft:FIELD_CONNECTED"), message.translate("general/minecraft:PLAYERS", { + count: (json.raw.players ? json.raw.players.online : json.players.length) + })) + .addField(message.translate("general/minecraft:FIELD_MAX"), message.translate("general/minecraft:PLAYERS", { + count: (json.raw.players ? json.raw.players.max : json.maxplayers) + })) .addField(message.translate("general/minecraft:FIELD_STATUS"), message.translate("general/minecraft:ONLINE")) .addField(message.translate("general/minecraft:FIELD_IP"), json.connect) .setColor(data.config.embed.color) .setThumbnail(favicon) .setFooter(data.config.embed.footer); - m.edit(null, [ mcEmbed, imgAttachment ]); + m.edit(null, [mcEmbed, imgAttachment]); } }; diff --git a/commands/General/permissions.js b/commands/General/permissions.js index 842d88f6..7cd22dc9 100644 --- a/commands/General/permissions.js +++ b/commands/General/permissions.js @@ -1,24 +1,25 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); + const permissions = Object.keys(Discord.Permissions.FLAGS); class Permissions extends Command { - constructor (client) { + constructor(client) { super(client, { name: "permissions", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "perms" ], + aliases: ["perms"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message) { + async run(message) { const member = message.mentions.members.first() || message.member; let text = "```\n" + `${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}\n\n`; const mPermissions = message.channel.permissionsFor(member); diff --git a/commands/General/ping.js b/commands/General/ping.js index 70665357..46540452 100644 --- a/commands/General/ping.js +++ b/commands/General/ping.js @@ -1,24 +1,30 @@ const Command = require("../../base/Command.js"); class Ping extends Command { - constructor (client) { + constructor(client) { super(client, { name: "ping", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "pong", "latency" ], + aliases: ["pong", "latency"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES" ], + botPermissions: ["SEND_MESSAGES"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message) { - message.sendT("general/ping:CONTENT", { ping: "..." }).then((m) => { - m.sendT("general/ping:CONTENT", { ping: m.createdTimestamp - message.createdTimestamp }, { edit: true }); + async run(message) { + message.sendT("general/ping:CONTENT", { + ping: "..." + }).then((m) => { + m.sendT("general/ping:CONTENT", { + ping: m.createdTimestamp - message.createdTimestamp + }, { + edit: true + }); }); } }; diff --git a/commands/General/quote.js b/commands/General/quote.js index ca0460d4..35186522 100644 --- a/commands/General/quote.js +++ b/commands/General/quote.js @@ -2,25 +2,29 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Quote extends Command { - constructor (client) { + constructor(client) { super(client, { name: "quote", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "quoter" ], + aliases: ["quoter"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { function embed(m) { const embed = new Discord.MessageEmbed() - .setAuthor(m.author.tag, m.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(m.author.tag, m.author.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setDescription(m.content) .setColor(m.member ? m.member.roles.highest ? m.member.roles.highest.color : data.config.embed.color : data.config.embed.color) .setFooter(m.guild.name + " | #" + m.channel.name) @@ -45,7 +49,9 @@ class Quote extends Command { if (!channel) { message.author.send(message.translate("general/quote:NO_MESSAGE_ID")).then(() => { message.delete(); - }).catch(() => { message.error("misc:CANNOT_DM") }); + }).catch(() => { + message.error("misc:CANNOT_DM") + }); return; }; }; @@ -54,7 +60,9 @@ class Quote extends Command { message.channel.messages.fetch(msgID).catch(() => { message.author.send((message.translate("general/quote:NO_MESSAGE_ID"))).then(() => { message.delete(); - }).catch(() => { message.error("misc:CANNOT_DM") }); + }).catch(() => { + message.error("misc:CANNOT_DM") + }); return; }).then((msg) => { message.delete(); @@ -64,7 +72,9 @@ class Quote extends Command { channel.messages.fetch(msgID).catch(() => { message.author.send(message.translate("general/quote:NO_MESSAGE_ID")).then(() => { message.delete(); - }).catch(() => { message.error("misc:CANNOT_DM") }); + }).catch(() => { + message.error("misc:CANNOT_DM") + }); return; }).then((msg) => { message.delete(); diff --git a/commands/General/remindme.js b/commands/General/remindme.js index 4b31963d..f057eadc 100644 --- a/commands/General/remindme.js +++ b/commands/General/remindme.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), ms = require("ms"); class Remindme extends Command { - constructor (client) { + constructor(client) { super(client, { name: "remindme", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "reminder" ], + aliases: ["reminder"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const time = args[0]; if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME"); @@ -27,7 +27,7 @@ class Remindme extends Command { const rData = { message: msg, createdAt: Date.now(), - sendAt: Date.now()+ms(time) + sendAt: Date.now() + ms(time) }; if (!data.userData.reminds) data.userData.reminds = []; @@ -38,7 +38,6 @@ class Remindme extends Command { data.userData.save(); this.client.databaseCache.usersReminds.set(message.author.id, data.userData); - // Send success message message.success("general/remindme:SAVED"); } }; diff --git a/commands/General/report.js b/commands/General/report.js index 3d16b208..b6d6c8f4 100644 --- a/commands/General/report.js +++ b/commands/General/report.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Report extends Command { - constructor (client) { + constructor(client) { super(client, { name: "report", dirname: __dirname, @@ -10,14 +10,14 @@ class Report extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const repChannel = message.guild.channels.cache.get(data.guild.plugins.reports); if (!repChannel) return message.error("general/report:MISSING_CHANNEL"); @@ -29,7 +29,13 @@ class Report extends Command { if (!rep) return message.error("general/report:MISSING_REASON"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/report:TITLE", { user: member.user.tag }), message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(message.translate("general/report:TITLE", { + user: member.user.tag + }), message.author.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .addField(message.translate("common:AUTHOR"), message.author.tag, true) .addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true) .addField(message.translate("common:REASON"), `**${rep}**`, true) @@ -45,7 +51,9 @@ class Report extends Command { await m.react(error); }); - message.success("general/report:SUCCESS", { channel: repChannel.toString() }); + message.success("general/report:SUCCESS", { + channel: repChannel.toString() + }); } }; diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js index 41f724c3..3f7329ea 100644 --- a/commands/General/serverinfo.js +++ b/commands/General/serverinfo.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Serverinfo extends Command { - constructor (client) { + constructor(client) { super(client, { name: "serverinfo", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "si" ], + aliases: ["si"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { let guild = message.guild; if (args[0]) { @@ -31,16 +31,30 @@ class Serverinfo extends Command { await guild.members.fetch(); const embed = new Discord.MessageEmbed() - .setAuthor(guild.name, guild.iconURL({ dynamic: true })) - .setThumbnail(guild.iconURL({ dynamic: true })) + .setAuthor(guild.name, guild.iconURL({ + dynamic: true + })) + .setThumbnail(guild.iconURL({ + dynamic: true + })) .addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true) .addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true) - .addField(this.client.customEmojis.users + message.translate("common:MEMBERS"), message.translate("general/serverinfo:MEMBERS", { count: guild.members.cache.filter(m => !m.user.bot).size }) + " | " + message.translate("general/serverinfo:BOTS", { count: guild.members.cache.filter(m => m.user.bot).size }), true) + .addField(this.client.customEmojis.users + message.translate("common:MEMBERS"), message.translate("general/serverinfo:MEMBERS", { + count: guild.members.cache.filter(m => !m.user.bot).size + }) + " | " + message.translate("general/serverinfo:BOTS", { + count: guild.members.cache.filter(m => m.user.bot).size + }), true) .addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel || message.translate("general/serverinfo:NO_AFK_CHANNEL"), true) .addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true) .addField(this.client.customEmojis.crown + message.translate("common:OWNER"), guild.owner, true) .addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || 0, true) - .addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"), message.translate("general/serverinfo:TEXT_CHANNELS", { count: guild.channels.cache.filter(c => c.type === "text").size }) + " | " + message.translate("general/serverinfo:VOICE_CHANNELS", { count: guild.channels.cache.filter(c => c.type === "voice").size }) + " | " + message.translate("general/serverinfo:CAT_CHANNELS", { count: guild.channels.cache.filter(c => c.type === "category").size }), true) + .addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"), message.translate("general/serverinfo:TEXT_CHANNELS", { + count: guild.channels.cache.filter(c => c.type === "text").size + }) + " | " + message.translate("general/serverinfo:VOICE_CHANNELS", { + count: guild.channels.cache.filter(c => c.type === "voice").size + }) + " | " + message.translate("general/serverinfo:CAT_CHANNELS", { + count: guild.channels.cache.filter(c => c.type === "category").size + }), true) .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); diff --git a/commands/General/setafk.js b/commands/General/setafk.js index 6503b22f..a012a227 100644 --- a/commands/General/setafk.js +++ b/commands/General/setafk.js @@ -1,27 +1,28 @@ const Command = require("../../base/Command.js"); class Setafk extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setafk", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "afk" ], + aliases: ["afk"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const reason = args.join(" "); if (!reason) return message.error("general/setafk:MISSING_REASON"); - // Send success message - message.success("general/setafk:SUCCESS", { reason }); + message.success("general/setafk:SUCCESS", { + reason + }); data.userData.afk = reason; data.userData.save(); diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js index 1bc7bd4e..e02ffe97 100644 --- a/commands/General/shorturl.js +++ b/commands/General/shorturl.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class ShortURL extends Command { - constructor (client) { + constructor(client) { super(client, { name: "shorturl", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "minimize" ], + aliases: ["minimize"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const url = args[0]; if (!url) return message.error("general/shorturl:MISSING_URL"); diff --git a/commands/General/someone.js b/commands/General/someone.js index 61bd7b4d..505b43fa 100644 --- a/commands/General/someone.js +++ b/commands/General/someone.js @@ -2,29 +2,33 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Someone extends Command { - constructor (client) { + constructor(client) { super(client, { name: "someone", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "somebody", "something" ], + aliases: ["somebody", "something"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args, data) { + async run(message, args, data) { const member = message.guild.members.cache.random(1)[0]; const embed = new Discord.MessageEmbed() .addField(message.translate("common:USERNAME"), member.user.username, true) .addField(message.translate("common:DISCRIMINATOR"), member.user.discriminator, true) .addField(message.translate("common:ID"), member.user.id, true) - .setThumbnail(member.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setThumbnail(member.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setColor(data.config.embed.color); message.channel.send(embed); } diff --git a/commands/General/staff.js b/commands/General/staff.js index 7b98ef80..241a7df0 100644 --- a/commands/General/staff.js +++ b/commands/General/staff.js @@ -2,27 +2,29 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Staff extends Command { - constructor (client) { + constructor(client) { super(client, { name: "staff", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "stafflist", "staffliste" ], + aliases: ["stafflist", "staffliste"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { await message.guild.members.fetch(); const administrators = message.guild.members.cache.filter((m) => m.hasPermission("ADMINISTRATOR") && !m.user.bot); const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.hasPermission("MANAGE_MESSAGES") && !m.user.bot); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/staff:TITLE", { guild: message.guild.name })) + .setAuthor(message.translate("general/staff:TITLE", { + guild: message.guild.name + })) .addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${this.client.customEmojis.status[a.presence.status]} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS"))) .addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${this.client.customEmojis.status[m.presence.status]} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS"))) .setColor(data.config.embed.color) diff --git a/commands/General/stats.js b/commands/General/stats.js index f8398bcf..4f89ff0c 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -2,35 +2,42 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Stats extends Command { - constructor (client) { + constructor(client) { super(client, { name: "stats", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "statistics", "infobot", "botinfos", "bot-infos", "bot-info", "infos-bot", "info-bot" ], + aliases: ["statistics", "infobot", "botinfos", "bot-infos", "bot-info", "infos-bot", "info-bot"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const statsEmbed = new Discord.MessageEmbed() .setColor(data.config.embed.color) .setFooter(data.config.embed.footer) .setAuthor(message.translate("common:STATS")) .setDescription(message.translate("general/stats:MADE")) - .addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", { servers: this.client.guilds.cache.size, users: this.client.users.cache.size }), true) + .addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", { + servers: this.client.guilds.cache.size, + users: this.client.users.cache.size + }), true) .addField(this.client.customEmojis.version + " " + message.translate("general/stats:VERSIONS_TITLE"), `\`Discord.js : v${Discord.version}\`\n\`Nodejs : v${process.versions.node}\``, true) .addField(this.client.customEmojis.ram + " " + message.translate("general/stats:RAM_TITLE"), `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, true) - .addField(this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"), message.translate("general/stats:ONLINE_CONTENT", { time: message.convertTime(Date.now()+this.client.uptime, "from", true) })) - .addField(this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", { count: this.client.voice.connections.size })) + .addField(this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"), message.translate("general/stats:ONLINE_CONTENT", { + time: message.convertTime(Date.now() + this.client.uptime, "from", true) + })) + .addField(this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", { + count: this.client.voice.connections.size + })) .addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", { - donators: [ ":(" ].join("\n"), - translators: [ "`Jonny_Bro#4226` (:flag_ru:)", "`[ДАННЫЕ УДАЛЕНЫ]#2789` (:flag_ua:)", "`FaxoNfuckyou#9398` и `Jonny_Bro#4226` (:flag_us:)" ].join("\n") + donators: [":("].join("\n"), + translators: ["`Jonny_Bro#4226` (:flag_ru:)", "`[ДАННЫЕ УДАЛЕНЫ]#2789` (:flag_ua:)", "`FaxoNfuckyou#9398` и `Jonny_Bro#4226` (:flag_us:)"].join("\n") })); statsEmbed.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", { diff --git a/commands/General/suggest.js b/commands/General/suggest.js index 8a9666b4..40712743 100644 --- a/commands/General/suggest.js +++ b/commands/General/suggest.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Suggest extends Command { - constructor (client) { + constructor(client) { super(client, { name: "suggest", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "suggestion", "sugg" ], + aliases: ["suggestion", "sugg"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions); if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL"); @@ -25,7 +25,13 @@ class Suggest extends Command { if (!sugg) return message.error("general/suggest:MISSING_CONTENT"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/suggest:TITLE", { user: message.author.username }), message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(message.translate("general/suggest:TITLE", { + user: message.author.username + }), message.author.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true) .addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true) .addField(message.translate("common:CONTENT"), sugg) @@ -40,7 +46,9 @@ class Suggest extends Command { await m.react(error); }); - message.success("general/suggest:SUCCESS", { channel: suggChannel.toString() }); + message.success("general/suggest:SUCCESS", { + channel: suggChannel.toString() + }); } }; diff --git a/commands/General/translate.js b/commands/General/translate.js index 60277232..3f894071 100644 --- a/commands/General/translate.js +++ b/commands/General/translate.js @@ -5,22 +5,22 @@ const Command = require("../../base/Command.js"), const langs = ["afrikaans", "albanian", "amharic", "arabic", "armenian", "azerbaijani", "bangla", "basque", "belarusian", "bengali", "bosnian", "bulgarian", "burmese", "catalan", "cebuano", "chichewa", "corsican", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "filipino", "finnish", "french", "frisian", "galician", "georgian", "german", "greek", "gujarati", "haitian creole", "hausa", "hawaiian", "hebrew", "hindi", "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian", "japanese", "javanese", "kannada", "kazakh", "khmer", "korean", "kurdish (kurmanji)", "kyrgyz", "lao", "latin", "latvian", "lithuanian", "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese", "maori", "marathi", "mongolian", "myanmar (burmese)", "nepali", "norwegian", "nyanja", "pashto", "persian", "polish", "portugese", "punjabi", "romanian", "russian", "samoan", "scottish gaelic", "serbian", "sesotho", "shona", "sindhi", "sinhala", "slovak", "slovenian", "somali", "spanish", "sundanese", "swahili", "swedish", "tajik", "tamil", "telugu", "thai", "turkish", "ukrainian", "urdu", "uzbek", "vietnamese", "welsh", "xhosa", "yiddish", "yoruba", "zulu"]; class Translate extends Command { - constructor (client) { + constructor(client) { super(client, { name: "translate", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "traduction", "translation", "trad" ], + aliases: ["traduction", "translation", "trad"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args, data) { + async run(message, args, data) { if (args[0] === "langs-list") { const langsList = "```css\n" + (langs.map((lang, i) => `${i + 1} - ${lang}`).join("\n")) + "```"; message.author.send(langsList).then(() => { @@ -31,7 +31,9 @@ class Translate extends Command { return; }; - const pWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const pWait = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); if (!args[0]) return pWait.error("general/translate:MISSING_LANGUAGE", { prefix: data.guild.prefix }, { edit: true }); if (!args[1]) return pWait.error("general/translate:MISSING_CONTENT", null, { edit: true }); @@ -40,18 +42,26 @@ class Translate extends Command { const language = args[0].toLowerCase(); const toTranslate = args.slice(1).join(" "); - if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language}, { edit: true }); + if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language }, { edit: true }); - const translated = await translate(toTranslate, { to: language }); + const translated = await translate(toTranslate, { + to: language + }); const resEmbed = new Discord.MessageEmbed() - .setAuthor("Translator", this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor("Translator", this.client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .addField(translated.from.language.iso, "```" + toTranslate + "```") .addField(language, "```" + translated.text + "```") .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); - return pWait.edit("", { embed: resEmbed }); + return pWait.edit("", { + embed: resEmbed + }); } }; diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js index d9a97bdf..3b376024 100644 --- a/commands/General/userinfo.js +++ b/commands/General/userinfo.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Userinfo extends Command { - constructor (client) { + constructor(client) { super(client, { name: "userinfo", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "ui" ], + aliases: ["ui"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { let displayPresence = true; const isID = !isNaN(args[0]); @@ -41,13 +41,23 @@ class Userinfo extends Command { if (message.guild) member = await message.guild.members.fetch(user).catch(() => {}); const embed = new Discord.MessageEmbed() - .setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) - .setThumbnail(user.displayAvatarURL({ dynamic: true })) + .setAuthor(user.tag, user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) + .setThumbnail(user.displayAvatarURL({ + dynamic: true + })) .addField(":man: " + message.translate("common:USERNAME"), user.username, true) .addField(this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"), user.discriminator, true) .addField(this.client.customEmojis.bot + " " + message.translate("common:ROBOT"), (user.bot ? message.translate("common:YES") : message.translate("common:NO")), true) .addField(this.client.customEmojis.calendar + " " + message.translate("common:CREATION"), message.printDate(user.createdAt), true) - .addField(this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .addField(this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); @@ -58,15 +68,19 @@ class Userinfo extends Command { if (member) { embed.addField(this.client.customEmojis.up + " " + message.translate("general/userinfo:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true) - embed.addField(this.client.customEmojis.calendar2 + " " + message.translate("common:JOIN"), message.printDate(member.joinedAt),true) + embed.addField(this.client.customEmojis.calendar2 + " " + message.translate("common:JOIN"), message.printDate(member.joinedAt), true) embed.addField(this.client.customEmojis.color + " " + message.translate("common:COLOR"), member.displayHexColor, true) embed.addField(this.client.customEmojis.pencil + " " + message.translate("common:NICKNAME"), (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")), true) - embed.addField(this.client.customEmojis.roles + " " + message.translate("common:ROLES"), (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 9).join(", ") + " " + message.translate("general/userinfo:MORE_ROLES", { count: member.roles.cache.size - 10 }) : (member.roles.cache.size < 1) ? message.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", "))); + embed.addField(this.client.customEmojis.roles + " " + message.translate("common:ROLES"), (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 9).join(", ") + " " + message.translate("general/userinfo:MORE_ROLES", { + count: member.roles.cache.size - 10 + }) : (member.roles.cache.size < 1) ? message.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", "))); }; if (user.bot && this.client.config.apiKeys.dbl && (this.client.config.apiKeys.dbl !== "")) { const res = await fetch("https://discordbots.org/api/bots/" + user.id, { - headers: { "Authorization": this.client.config.apiKeys.dbl } + headers: { + "Authorization": this.client.config.apiKeys.dbl + } }); const data = await res.json(); if (!data.error) { diff --git a/commands/Images/approved.js b/commands/Images/approved.js index 0cb1cb5b..55b5d6d2 100644 --- a/commands/Images/approved.js +++ b/commands/Images/approved.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Approved extends Command { - constructor (client) { + constructor(client) { super(client, { name: "approved", dirname: __dirname, @@ -10,19 +10,27 @@ class Approved extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("approved", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("approved", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "approved.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/avatar.js b/commands/Images/avatar.js index b3e46dda..2da4a36f 100644 --- a/commands/Images/avatar.js +++ b/commands/Images/avatar.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Avatar extends Command { - constructor (client) { + constructor(client) { super(client, { name: "avatar", dirname: __dirname, @@ -10,20 +10,25 @@ class Avatar extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { let user = await this.client.resolveUser(args[0]); if (!user) user = message.author; - const avatarURL = user.displayAvatarURL({ size: 512, dynamic: true, format: "png" }); - if (message.content.includes("-v")) message.channel.send(`<${avatarURL}>`); - const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`); + const avatarURL = user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + }); + if (message.content.includes("link")) message.channel.send(`<${avatarURL}>`); + + const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`); message.channel.send(attachment); } }; diff --git a/commands/Images/batslap.js b/commands/Images/batslap.js index b65673dd..cfe588a7 100644 --- a/commands/Images/batslap.js +++ b/commands/Images/batslap.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class BatSlap extends Command { - constructor (client) { + constructor(client) { super(client, { name: "batslap", dirname: __dirname, @@ -10,22 +10,34 @@ class BatSlap extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const users = [ await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[1]) || message.author ]; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("batslap", { avatar: users[0].displayAvatarURL({ format: "png", size: 512 }), url: users[1].displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("batslap", { + avatar: users[0].displayAvatarURL({ + format: "png", + size: 512 + }), + url: users[1].displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "batslap.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/beautiful.js b/commands/Images/beautiful.js index 79814dbc..09397ccd 100644 --- a/commands/Images/beautiful.js +++ b/commands/Images/beautiful.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Beautiful extends Command { - constructor (client) { + constructor(client) { super(client, { name: "beautiful", dirname: __dirname, @@ -10,19 +10,27 @@ class Beautiful extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("beautiful", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("beautiful", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "beautiful.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/bed.js b/commands/Images/bed.js index e05adad4..517e010e 100644 --- a/commands/Images/bed.js +++ b/commands/Images/bed.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), canvacord = require("canvacord"); class Bed extends Command { - constructor (client) { + constructor(client) { super(client, { name: "bed", dirname: __dirname, @@ -11,28 +11,36 @@ class Bed extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const users = [ await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[1]) || message.author ]; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); try { - const buffer = await canvacord.Canvas.bed(users[0].displayAvatarURL({ format: "png" }), users[1].displayAvatarURL({ format: "png" })); + const buffer = await canvacord.Canvas.bed(users[0].displayAvatarURL({ + format: "png" + }), users[1].displayAvatarURL({ + format: "png" + })); const attachment = new Discord.MessageAttachment(buffer, "bed.png"); message.channel.send(attachment); m.delete(); - } catch(e) { + } catch (e) { console.log(e); - m.error("misc:ERROR_OCCURRED", null, { edit: true }); + m.error("misc:ERROR_OCCURRED", null, { + edit: true + }); }; } }; diff --git a/commands/Images/brazzers.js b/commands/Images/brazzers.js index bd7353d2..69cbdcda 100644 --- a/commands/Images/brazzers.js +++ b/commands/Images/brazzers.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Brazzers extends Command { - constructor (client) { + constructor(client) { super(client, { name: "brazzers", dirname: __dirname, @@ -10,19 +10,27 @@ class Brazzers extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("brazzers", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("brazzers", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "brazzers.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/burn.js b/commands/Images/burn.js index 392ade01..41a7a71d 100644 --- a/commands/Images/burn.js +++ b/commands/Images/burn.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Burn extends Command { - constructor (client) { + constructor(client) { super(client, { name: "burn", dirname: __dirname, @@ -10,19 +10,27 @@ class Burn extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("burn", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("burn", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "burn.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/captcha.js b/commands/Images/captcha.js index 86695a77..4c91a512 100644 --- a/commands/Images/captcha.js +++ b/commands/Images/captcha.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Captcha extends Command { - constructor (client) { + constructor(client) { super(client, { name: "captcha", dirname: __dirname, @@ -11,23 +11,25 @@ class Captcha extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); try { const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=captcha&username=${user.username}&url=${user.displayAvatarURL({ format: "png", size: 512 })}`)); const json = await res.json(); const attachment = new Discord.MessageAttachment(json.message, "captcha.png"); message.channel.send(attachment); m.delete(); - } catch(e) { + } catch (e) { console.log(e); m.error("misc:ERR_OCCURRED", null, { edit: true diff --git a/commands/Images/challenger.js b/commands/Images/challenger.js index 20bb025a..eee11037 100644 --- a/commands/Images/challenger.js +++ b/commands/Images/challenger.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Challenger extends Command { - constructor (client) { + constructor(client) { super(client, { name: "challenger", dirname: __dirname, @@ -10,19 +10,27 @@ class Challenger extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("challenger", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("challenger", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "challenger.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/clyde.js b/commands/Images/clyde.js index e1442a39..53d60e03 100644 --- a/commands/Images/clyde.js +++ b/commands/Images/clyde.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Clyde extends Command { - constructor (client) { + constructor(client) { super(client, { name: "clyde", dirname: __dirname, @@ -11,28 +11,32 @@ class Clyde extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const text = args.join(" "); if (!text) return message.error("images/clyde:MISSING_TEXT"); - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); try { const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`)); const json = await res.json(); const attachment = new Discord.MessageAttachment(json.message, "clyde.png"); message.channel.send(attachment); m.delete(); - } catch(e) { + } catch (e) { console.log(e); - m.error("misc:ERROR_OCCURRED", null, { edit: true }); + m.error("misc:ERROR_OCCURRED", null, { + edit: true + }); }; } }; diff --git a/commands/Images/dictator.js b/commands/Images/dictator.js index 2d6ec5d9..a9dc96e3 100644 --- a/commands/Images/dictator.js +++ b/commands/Images/dictator.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Dictator extends Command { - constructor (client) { + constructor(client) { super(client, { name: "dictator", dirname: __dirname, @@ -10,19 +10,27 @@ class Dictator extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("dictator", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("dictator", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "dictator.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/facepalm.js b/commands/Images/facepalm.js index 999423e8..57dd2908 100644 --- a/commands/Images/facepalm.js +++ b/commands/Images/facepalm.js @@ -3,24 +3,26 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Facepalm extends Command { - constructor (client) { + constructor(client) { super(client, { name: "facepalm", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "palm" ], + aliases: ["palm"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author, - m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); const canvas = Canvas.createCanvas(632, 357), ctx = canvas.getContext("2d"); @@ -30,7 +32,10 @@ class Facepalm extends Command { ctx.fillRect(0, 0, 632, 357); // Draw avatar - const avatar = await Canvas.loadImage(user.displayAvatarURL({ format: "png", size: 512 })); + const avatar = await Canvas.loadImage(user.displayAvatarURL({ + format: "png", + size: 512 + })); ctx.drawImage(avatar, 199, 112, 235, 235); // Draw layer @@ -40,6 +45,7 @@ class Facepalm extends Command { const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "facepalm.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/fire.js b/commands/Images/fire.js index 40757441..940f6950 100644 --- a/commands/Images/fire.js +++ b/commands/Images/fire.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Fire extends Command { - constructor (client) { + constructor(client) { super(client, { name: "fire", dirname: __dirname, @@ -10,19 +10,27 @@ class Fire extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("fire", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("fire", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "fire.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/jail.js b/commands/Images/jail.js index 21a6a9ce..0321abc5 100644 --- a/commands/Images/jail.js +++ b/commands/Images/jail.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Jail extends Command { - constructor (client) { + constructor(client) { super(client, { name: "jail", dirname: __dirname, @@ -10,19 +10,27 @@ class Jail extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("jail", { url: user.displayAvatarURL({ format: "png", size: 1024 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("jail", { + url: user.displayAvatarURL({ + format: "png", + size: 1024 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "jail.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/love.js b/commands/Images/love.js index ae83884d..04b8cbca 100644 --- a/commands/Images/love.js +++ b/commands/Images/love.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Love extends Command { - constructor (client) { + constructor(client) { super(client, { name: "love", dirname: __dirname, @@ -11,29 +11,33 @@ class Love extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const users = [ await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[1]) || message.author ]; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); try { const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=ship&user1=${users[0].displayAvatarURL({ format: "png", size: 512 })}&user2=${users[1].displayAvatarURL({ format: "png", size: 512 })}`)); const json = await res.json(); const attachment = new Discord.MessageAttachment(json.message, "love.png"); message.channel.send(attachment); m.delete(); - } catch(e) { + } catch (e) { console.log(e); - m.error("misc:ERROR_OCCURRED", null, { edit: true }); + m.error("misc:ERROR_OCCURRED", null, { + edit: true + }); }; } }; diff --git a/commands/Images/mission.js b/commands/Images/mission.js index 48a3a863..14d0ffa4 100644 --- a/commands/Images/mission.js +++ b/commands/Images/mission.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Mission extends Command { - constructor (client) { + constructor(client) { super(client, { name: "mission", dirname: __dirname, @@ -10,19 +10,27 @@ class Mission extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("images/mission:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("missionpassed", { url: user.displayAvatarURL({ format: "png", size: 2048 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("missionpassed", { + url: user.displayAvatarURL({ + format: "png", + size: 2048 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "mission.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/phcomment.js b/commands/Images/phcomment.js index 2835b67f..5a8a3f96 100644 --- a/commands/Images/phcomment.js +++ b/commands/Images/phcomment.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), canvacord = require("canvacord"); class Phcomment extends Command { - constructor (client) { + constructor(client) { super(client, { name: "phcomment", dirname: __dirname, @@ -11,14 +11,14 @@ class Phcomment extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { let user = await this.client.resolveUser(args[0]); let text = args.join(" "); @@ -36,15 +36,19 @@ class Phcomment extends Command { try { const buffer = await canvacord.Canvas.phub({ username: user.username, - image: user.displayAvatarURL({ format: "png" }), + image: user.displayAvatarURL({ + format: "png" + }), message: text }); const attachment = new Discord.MessageAttachment(buffer, "phcomment.png"); message.channel.send(attachment); m.delete(); - } catch(e) { + } catch (e) { console.log(e); - m.error("misc:ERROR_OCCURRED", null, { edit: true }); + m.error("misc:ERROR_OCCURRED", null, { + edit: true + }); }; } }; diff --git a/commands/Images/qrcode.js b/commands/Images/qrcode.js index 1c09cd01..90fde6ab 100644 --- a/commands/Images/qrcode.js +++ b/commands/Images/qrcode.js @@ -2,32 +2,36 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Qrcode extends Command { - constructor (client) { + constructor(client) { super(client, { name: "qrcode", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "qr" ], + aliases: ["qr"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const text = args.join(" "); if (!text) return message.error("images/qrcode:MISSING_TEXT"); - const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); const embed = new Discord.MessageEmbed() .setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`) .setColor(data.config.embed.color); - pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), { embed }); + pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), { + embed + }); } }; diff --git a/commands/Images/rip.js b/commands/Images/rip.js index 243c3155..6b874b8d 100644 --- a/commands/Images/rip.js +++ b/commands/Images/rip.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Rip extends Command { - constructor (client) { + constructor(client) { super(client, { name: "rip", dirname: __dirname, @@ -10,19 +10,27 @@ class Rip extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("rip", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("rip", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "rip.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/scary.js b/commands/Images/scary.js index 632c59e9..193a632c 100644 --- a/commands/Images/scary.js +++ b/commands/Images/scary.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Scary extends Command { - constructor (client) { + constructor(client) { super(client, { name: "scary", dirname: __dirname, @@ -10,19 +10,27 @@ class Scary extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("scary", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("scary", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "scary.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/tobecontinued.js b/commands/Images/tobecontinued.js index 6b84ec9d..0a22af49 100644 --- a/commands/Images/tobecontinued.js +++ b/commands/Images/tobecontinued.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Tobecontinued extends Command { - constructor (client) { + constructor(client) { super(client, { name: "tobecontinued", dirname: __dirname, @@ -10,19 +10,27 @@ class Tobecontinued extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("tobecontinued", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("tobecontinued", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "tobecontinued.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/trash.js b/commands/Images/trash.js index 1afb395f..5ed59cb9 100644 --- a/commands/Images/trash.js +++ b/commands/Images/trash.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), canvacord = require("canvacord"); class Trash extends Command { - constructor (client) { + constructor(client) { super(client, { name: "trash", dirname: __dirname, @@ -11,19 +11,25 @@ class Trash extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await canvacord.Canvas.trash(user.displayAvatarURL({ format: "png", size: 512 })); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await canvacord.Canvas.trash(user.displayAvatarURL({ + format: "png", + size: 512 + })); const attachment = new Discord.MessageAttachment(buffer, "trash.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/triggered.js b/commands/Images/triggered.js index 67c5a83c..f71ce49f 100644 --- a/commands/Images/triggered.js +++ b/commands/Images/triggered.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Triggered extends Command { - constructor (client) { + constructor(client) { super(client, { name: "triggered", dirname: __dirname, @@ -10,19 +10,29 @@ class Triggered extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("triggered", { url: user.displayAvatarURL({ format: "png", size: 512 }), sepia: "true", invert: "true" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("triggered", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }), + sepia: "true", + invert: "true" + }); const attachment = new Discord.MessageAttachment(buffer, "triggered.gif"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/tweet.js b/commands/Images/tweet.js index 8df6b97f..51c7ef9e 100644 --- a/commands/Images/tweet.js +++ b/commands/Images/tweet.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Tweet extends Command { - constructor (client) { + constructor(client) { super(client, { name: "tweet", dirname: __dirname, enabled: false, guildOnly: false, - aliases: [ "twitter" ], + aliases: ["twitter"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = message.mentions.users.first() || message.author; const text = args.slice(1).join(" "); @@ -25,7 +25,9 @@ class Tweet extends Command { if (!text) return message.error("images/tweet:MISSING_TEXT"); - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); await message.guild.members.fetch(); const randomMembers = message.guild.members.cache.random(3); @@ -39,6 +41,7 @@ class Tweet extends Command { }); const attachment = new Discord.MessageAttachment(buffer, "twitter.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/wanted.js b/commands/Images/wanted.js index 0938d44c..d5a86b8d 100644 --- a/commands/Images/wanted.js +++ b/commands/Images/wanted.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Wanted extends Command { - constructor (client) { + constructor(client) { super(client, { name: "wanted", dirname: __dirname, @@ -10,19 +10,27 @@ class Wanted extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("wanted", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("wanted", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "wanted.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/wasted.js b/commands/Images/wasted.js index b579ecd1..c0e9dc64 100644 --- a/commands/Images/wasted.js +++ b/commands/Images/wasted.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Wasted extends Command { - constructor (client) { + constructor(client) { super(client, { name: "wasted", dirname: __dirname, @@ -10,19 +10,27 @@ class Wasted extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { const user = await this.client.resolveUser(args[0]) || message.author; - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); - const buffer = await this.client.AmeAPI.generate("wasted", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); + const buffer = await this.client.AmeAPI.generate("wasted", { + url: user.displayAvatarURL({ + format: "png", + size: 512 + }) + }); const attachment = new Discord.MessageAttachment(buffer, "wasted.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Images/youtube-comment.js b/commands/Images/youtube-comment.js index b49c9d27..23bb1e84 100644 --- a/commands/Images/youtube-comment.js +++ b/commands/Images/youtube-comment.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), canvacord = require("canvacord"); class YouTubeComment extends Command { - constructor (client) { + constructor(client) { super(client, { name: "youtube-comment", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "ytcomment" ], + aliases: ["ytcomment"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: false, ownerOnly: false, cooldown: 5000 }); } - async run (message, args) { + async run(message, args) { let user = await this.client.resolveUser(args[0]); let text = args.join(" "); @@ -30,14 +30,19 @@ class YouTubeComment extends Command { if (!text) return message.error("images/phcomment:MISSING_TEXT"); // same text as phcomment - const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); + const m = await message.sendT("misc:PLEASE_WAIT", null, { + prefixEmoji: "loading" + }); const image = await canvacord.Canvas.youtube({ username: user.username, - avatar: user.displayAvatarURL({ format: "png" }), + avatar: user.displayAvatarURL({ + format: "png" + }), content: text }); const attachment = new Discord.MessageAttachment(image, "ytb-comment.png"); m.delete(); + message.channel.send(attachment); } }; diff --git a/commands/Moderation/announcement.js b/commands/Moderation/announcement.js index 4926c962..5473ebdd 100644 --- a/commands/Moderation/announcement.js +++ b/commands/Moderation/announcement.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Announcement extends Command { - constructor (client) { + constructor(client) { super(client, { name: "announcement", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MENTION_EVERYONE" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MENTION_EVERYONE"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const text = args.join(" "); if (!text) return message.error("moderation/announcement:MISSING_TEXT"); if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG"); @@ -26,7 +26,10 @@ class Announcement extends Command { let mention = ""; const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 240000 }); + const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + time: 240000 + }); + collector.on("collect", async (tmsg) => { if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) { tmsg.delete(); @@ -38,7 +41,9 @@ class Announcement extends Command { tmsg.delete(); msg.delete(); const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); - const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 60000 }); + const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + time: 60000 + }); c.on("collect", (m) => { if (m.content.toLowerCase() === "here") { mention = "@here"; @@ -55,17 +60,13 @@ class Announcement extends Command { }; }); c.on("end", (collected, reason) => { - if (reason === "time") { - return message.error("misc:TIMES_UP"); - }; + if (reason === "time") return message.error("misc:TIMES_UP"); }); }; }); collector.on("end", (collected, reason) => { - if (reason === "time") { - return message.error("misc:TIMES_UP"); - }; + if (reason === "time") return message.error("misc:TIMES_UP"); const embed = new Discord.MessageEmbed() .setAuthor(message.translate("moderation/announcement:TITLE")) diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js index d5b739e1..64c630fc 100644 --- a/commands/Moderation/ban.js +++ b/commands/Moderation/ban.js @@ -2,32 +2,37 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Ban extends Command { - constructor (client) { + constructor(client) { super(client, { name: "ban", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "BAN_MEMBERS" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS" ], + memberPermissions: ["BAN_MEMBERS"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const user = await this.client.resolveUser(args[0]); if (!user) return message.error("moderation/ban:MISSING_MEMBER"); - const memberData = message.guild.members.cache.get(user.id) ? await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }) : null; + const memberData = message.guild.members.cache.get(user.id) ? await this.client.findOrCreateMember({ + id: user.id, + guildID: message.guild.id + }) : null; if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF"); // If the user is already banned const banned = await message.guild.fetchBans(); - if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", { username: user.tag }); + if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", { + username: user.tag + }); // Gets the ban reason let reason = args.slice(1).join(" "); @@ -37,7 +42,7 @@ class Ban extends Command { if (member) { const memberPosition = member.roles.highest.position; const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition))return message.error("moderation/ban:SUPERIOR"); + if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); if (!member.bannable) return message.error("moderation/ban:MISSING_PERM"); }; @@ -49,7 +54,9 @@ class Ban extends Command { })).catch(() => {}); // Ban the user - message.guild.members.ban(user, { reason } ).then(() => { + message.guild.members.ban(user, { + reason + }).then(() => { // Send a success message in the current channel message.sendT("moderation/ban:BANNED", { username: user.tag, @@ -79,7 +86,9 @@ class Ban extends Command { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/ban:CASE", { count: data.guild.casesCount })) + .setAuthor(message.translate("moderation/ban:CASE", { + count: data.guild.casesCount + })) .addField(message.translate("common:USER"), `\`${user.tag}\` (${user.toString()})`, true) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) .addField(message.translate("common:REASON"), reason, true) diff --git a/commands/Moderation/checkinvites.js b/commands/Moderation/checkinvites.js index 02a72525..a65ca26a 100644 --- a/commands/Moderation/checkinvites.js +++ b/commands/Moderation/checkinvites.js @@ -2,27 +2,27 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Checkinvites extends Command { - constructor (client) { + constructor(client) { super(client, { name: "checkinvites", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "checkinvite", "checki" ], + aliases: ["checkinvite", "checki"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const members = message.guild.members; const withInvite = []; members.cache.forEach((m) => { - const possibleLinks = m.user.presence.activities.map((a) => [ a.state, a.details, a.name ]).flat(); + const possibleLinks = m.user.presence.activities.map((a) => [a.state, a.details, a.name]).flat(); const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l)); if (inviteLinks.length > 0) { withInvite.push({ @@ -40,7 +40,11 @@ class Checkinvites extends Command { .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); - message.channel.send(embed); + const m = await message.channel.send(embed); + + setTimeout(function () { + m.delete(); + }, 3000); } }; diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index 666f00ee..67b520a0 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Clear extends Command { - constructor (client) { + constructor(client) { super(client, { name: "clear", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "clear", "bulkdelete", "purge" ], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "MANAGE_MESSAGES" ], + aliases: ["clear", "bulkdelete", "purge"], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_MESSAGES"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { if (args[0] === "all") { message.sendT("moderation/clear:ALL_CONFIRM"); await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), { @@ -40,7 +40,9 @@ class Clear extends Command { const user = message.mentions.users.first(); - let messages = await message.channel.messages.fetch({limit:100}); + let messages = await message.channel.messages.fetch({ + limit: 100 + }); messages = messages.array(); if (user) messages = messages.filter((m) => m.author.id === user.id); if (messages.length > amount) messages.length = parseInt(amount, 10); @@ -53,12 +55,17 @@ class Clear extends Command { let toDelete = null; if (user) { - toDelete = await message.success("moderation/clear:CLEARED_MEMBER", { amount: --amount, username: user.tag }); + toDelete = await message.success("moderation/clear:CLEARED_MEMBER", { + amount: --amount, + username: user.tag + }); } else { - toDelete = await message.success("moderation/clear:CLEARED", { amount: --amount }); + toDelete = await message.success("moderation/clear:CLEARED", { + amount: --amount + }); }; - setTimeout(function() { + setTimeout(function () { toDelete.delete(); }, 2000); } diff --git a/commands/Moderation/clearsanctions.js b/commands/Moderation/clearsanctions.js index d0e6d6eb..4ee71a04 100644 --- a/commands/Moderation/clearsanctions.js +++ b/commands/Moderation/clearsanctions.js @@ -1,29 +1,34 @@ const Command = require("../../base/Command.js"); class Clearsanctions extends Command { - constructor (client) { + constructor(client) { super(client, { name: "clearsanctions", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "clearwarns" ], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["clearwarns"], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.error("moderation/clear-sanctions:MISSING_MEMBER"); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); memberData.sanctions = []; memberData.save(); - message.success("moderation/clear-sanctions:SUCCESS", { username: member.user.tag }); + message.success("moderation/clear-sanctions:SUCCESS", { + username: member.user.tag + }); } }; diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js index 32d6832e..09d315f4 100644 --- a/commands/Moderation/giveaway.js +++ b/commands/Moderation/giveaway.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), ms = require("ms"); class Giveaway extends Command { - constructor (client) { + constructor(client) { super(client, { name: "giveaway", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "gway" ], - memberPermissions: [ "MENTION_EVERYONE" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["gway"], + memberPermissions: ["MENTION_EVERYONE"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const status = args[0]; if (!status) return message.error("moderation/giveaway:MISSING_STATUS"); @@ -36,6 +36,7 @@ class Giveaway extends Command { const prize = args.slice(3).join(" "); if (!prize) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); + this.client.giveawaysManager.start(message.channel, { time: ms(time), prize: prize, @@ -51,10 +52,18 @@ class Giveaway extends Command { winners: message.translate("moderation/giveaway:WINNERS"), endedAt: message.translate("moderation/giveaway:END_AT"), units: { - seconds: message.translate("time:SECONDS", { amount: "" }).trim(), - minutes: message.translate("time:MINUTES", { amount: "" }).trim(), - hours: message.translate("time:HOURS", { amount: "" }).trim(), - days: message.translate("time:DAYS", { amount: "" }).trim() + seconds: message.translate("time:SECONDS", { + amount: "" + }).trim(), + minutes: message.translate("time:MINUTES", { + amount: "" + }).trim(), + hours: message.translate("time:HOURS", { + amount: "" + }).trim(), + days: message.translate("time:DAYS", { + amount: "" + }).trim() } } }).then(() => { @@ -62,7 +71,7 @@ class Giveaway extends Command { }); } else if (status === "reroll") { const messageID = args[1]; - if (!messageID)return message.error("moderation/giveaway:MISSING_ID"); + if (!messageID) return message.error("moderation/giveaway:MISSING_ID"); this.client.giveawaysManager.reroll(messageID, { congrat: message.translate("moderation/giveaway:REROLL_CONGRAT"), @@ -70,7 +79,9 @@ class Giveaway extends Command { }).then(() => { return message.success("moderation/giveaway:GIVEAWAY_REROLLED"); }).catch(() => { - return message.error("moderation/giveaway:NOT_FOUND_ENDED", { messageID }); + return message.error("moderation/giveaway:NOT_FOUND_ENDED", { + messageID + }); }); } else if (status === "delete") { const messageID = args[1]; @@ -79,17 +90,23 @@ class Giveaway extends Command { this.client.giveawaysManager.delete(messageID).then(() => { return message.success("moderation/giveaway:GIVEAWAY_DELETED"); }).catch(() => { - return message.error("moderation/giveaway:NOT_FOUND", { messageID }); + return message.error("moderation/giveaway:NOT_FOUND", { + messageID + }); }); } else if (status === "end") { const messageID = args[1]; if (!messageID) return message.error("moderation/giveaway:MISSING_ID"); try { - this.client.giveawaysManager.edit(messageID, { setEndTimestamp: Date.now() }); + this.client.giveawaysManager.edit(messageID, { + setEndTimestamp: Date.now() + }); return message.success("moderation/giveaway:GIVEAWAY_ENDED"); - } catch(e) { - return message.error("moderation/giveaway:NOT_FOUND", { messageID }); + } catch (e) { + return message.error("moderation/giveaway:NOT_FOUND", { + messageID + }); }; } else { return message.error("moderation/giveaway:MISSING_STATUS"); diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js index b8fb3fbb..759e3f89 100644 --- a/commands/Moderation/kick.js +++ b/commands/Moderation/kick.js @@ -2,28 +2,31 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Kick extends Command { - constructor (client) { + constructor(client) { super(client, { name: "kick", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "KICK_MEMBERS" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "KICK_MEMBERS" ], + memberPermissions: ["KICK_MEMBERS"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "KICK_MEMBERS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.error("moderation/kick:MISSING_MEMBER"); if (member.id === message.author.id) return message.error("moderation/kick:YOURSELF"); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); // Gets the kcik reason let reason = args.slice(1).join(" "); @@ -70,7 +73,9 @@ class Kick extends Command { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/kick:CASE", { count: data.guild.casesCount})) + .setAuthor(message.translate("moderation/kick:CASE", { + count: data.guild.casesCount + })) .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) .addField(message.translate("common:REASON"), reason, true) diff --git a/commands/Moderation/mute.js b/commands/Moderation/mute.js index ac46bfee..53e371f8 100644 --- a/commands/Moderation/mute.js +++ b/commands/Moderation/mute.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), ms = require("ms"); class Mute extends Command { - constructor (client) { + constructor(client) { super(client, { name: "mute", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS" ], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.error("moderation/mute:MISSING_MEMBER"); if (member.id === message.author.id) return message.error("moderation/ban:YOURSELF"); @@ -27,7 +27,10 @@ class Mute extends Command { const moderationPosition = message.member.roles.highest.position; if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); const time = args[1]; if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME"); @@ -71,7 +74,7 @@ class Mute extends Command { }; memberData.mute.muted = true; - memberData.mute.endDate = Date.now()+ms(time); + memberData.mute.endDate = Date.now() + ms(time); memberData.mute.case = data.guild.casesCount; memberData.sanctions.push(caseInfo); @@ -87,12 +90,14 @@ class Mute extends Command { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/mute:CASE", { count: data.guild.casesCount })) + .setAuthor(message.translate("moderation/mute:CASE", { + count: data.guild.casesCount + })) .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) .addField(message.translate("common:REASON"), reason, true) .addField(message.translate("common:DURATION"), time, true) - .addField(message.translate("common:EXPIRY"), message.printDate(new Date(Date.now()+ms(time))), true) + .addField(message.translate("common:EXPIRY"), message.printDate(new Date(Date.now() + ms(time))), true) .setColor("#f44271"); channel.send(embed); } diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js index 3e5961ee..d14ff52a 100644 --- a/commands/Moderation/poll.js +++ b/commands/Moderation/poll.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Poll extends Command { - constructor (client) { + constructor(client) { super(client, { name: "poll", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MENTION_EVERYONE" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MENTION_EVERYONE"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const question = args.join(" "); if (!question) return message.error("moderation/poll:MISSING_QUESTION"); @@ -25,7 +25,10 @@ class Poll extends Command { let mention = ""; const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 240000 }); + const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + time: 240000 + }); + collector.on("collect", async (tmsg) => { if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) { tmsg.delete(); @@ -37,7 +40,10 @@ class Poll extends Command { tmsg.delete(); msg.delete(); const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); - const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 60000 }); + const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + time: 60000 + }); + c.on("collect", (m) => { if (m.content.toLowerCase() === "here") { mention = "@here"; @@ -54,17 +60,13 @@ class Poll extends Command { }; }); c.on("end", (collected, reason) => { - if (reason === "time") { - return message.error("misc:TIMES_UP"); - }; + if (reason === "time") return message.error("misc:TIMES_UP"); }); }; }); collector.on("end", (collected, reason) => { - if (reason === "time") { - return message.error("misc:TIMES_UP"); - }; + if (reason === "time") return message.error("misc:TIMES_UP"); const success = this.client.customEmojis.success.split(":")[1]; const error = this.client.customEmojis.error.split(":")[1]; @@ -77,7 +79,10 @@ class Poll extends Command { const embed = new Discord.MessageEmbed() .setAuthor(message.translate("moderation/poll:TITLE")) .setColor(data.config.embed.color) - .addField(question, message.translate("moderation/poll:REACT", { success: emojis[0].toString(), error: emojis[1].toString() })); + .addField(question, message.translate("moderation/poll:REACT", { + success: emojis[0].toString(), + error: emojis[1].toString() + })); message.channel.send(mention, embed).then(async (m) => { await m.react(emojis[0]); diff --git a/commands/Moderation/sanctions.js b/commands/Moderation/sanctions.js index 2bb6e2ff..4a4b48f3 100644 --- a/commands/Moderation/sanctions.js +++ b/commands/Moderation/sanctions.js @@ -2,34 +2,43 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Sanctions extends Command { - constructor (client) { + constructor(client) { super(client, { name: "sanctions", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "warns" ], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + aliases: ["warns"], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const user = await this.client.resolveUser(args[0]); if (!user) return message.error("moderation/sanctions:MISSING_MEMBER"); - const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: user.id, + guildID: message.guild.id + }); const embed = new Discord.MessageEmbed() - .setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(user.tag, user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); if (memberData.sanctions.length < 1) { - embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", { username: user.tag })); + embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", { + username: user.tag + })); return message.channel.send(embed); } else { memberData.sanctions.forEach((s) => { diff --git a/commands/Moderation/setwarns.js b/commands/Moderation/setwarns.js index c0ded981..e05ab90e 100644 --- a/commands/Moderation/setwarns.js +++ b/commands/Moderation/setwarns.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Setwarns extends Command { - constructor (client) { + constructor(client) { super(client, { name: "setwarns", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_GUILD" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS", "KICK_MEMBERS" ], + memberPermissions: ["MANAGE_GUILD"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS", "KICK_MEMBERS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const sanction = args[0]; if (!sanction || (sanction !== "kick" && sanction !== "ban")) return message.error("moderation/setwarns:MISSING_TYPE"); @@ -27,12 +27,18 @@ class Setwarns extends Command { data.guild.plugins.warnsSanctions.kick = false; data.guild.markModified("plugins.warnsSanctions"); data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { prefix: data.guild.prefix, count: number }); + return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { + prefix: data.guild.prefix, + count: number + }); } else if (sanction === "ban") { data.guild.plugins.warnsSanctions.ban = false; data.guild.markModified("plugins.warnsSanctions"); data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_BAN_RESET", { prefix: data.guild.prefix, count: number }); + return message.success("moderation/setwarns:SUCCESS_BAN_RESET", { + prefix: data.guild.prefix, + count: number + }); }; }; @@ -43,12 +49,18 @@ class Setwarns extends Command { data.guild.plugins.warnsSanctions.kick = number; data.guild.markModified("plugins.warnsSanctions"); data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_KICK", { prefix: data.guild.prefix, count: number }); + return message.success("moderation/setwarns:SUCCESS_KICK", { + prefix: data.guild.prefix, + count: number + }); } else if (sanction === "ban") { data.guild.plugins.warnsSanctions.ban = number; data.guild.markModified("plugins.warnsSanctions"); data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_BAN", { prefix: data.guild.prefix, count: number }); + return message.success("moderation/setwarns:SUCCESS_BAN", { + prefix: data.guild.prefix, + count: number + }); }; } }; diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js index 83eef77d..13c3b311 100644 --- a/commands/Moderation/unban.js +++ b/commands/Moderation/unban.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Unban extends Command { - constructor (client) { + constructor(client) { super(client, { name: "unban", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "BAN_MEMBERS" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS" ], + memberPermissions: ["BAN_MEMBERS"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { let user = null; if (!args[0]) return message.error("moderation/unban:MISSING_ID"); @@ -50,7 +50,10 @@ class Unban extends Command { message.guild.members.unban(user).catch(() => {}); // Send a success message in the current channel - message.success("moderation/unban:UNBANNED", { username: user.tag, server: message.guild.name }); + message.success("moderation/unban:UNBANNED", { + username: user.tag, + server: message.guild.name + }); } }; diff --git a/commands/Moderation/unmute.js b/commands/Moderation/unmute.js index 35fc22a6..f999278a 100644 --- a/commands/Moderation/unmute.js +++ b/commands/Moderation/unmute.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Unmute extends Command { - constructor (client) { + constructor(client) { super(client, { name: "unmute", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS" ], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args) { + async run(message, args) { const member = await this.client.resolveMember(args[0], message.guild); if (!member) return message.success("moderation/unmute:MISSING_MEMBER"); @@ -24,15 +24,22 @@ class Unmute extends Command { const moderationPosition = message.member.roles.highest.position; if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); if (memberData.mute.muted) { memberData.mute.endDate = Date.now(); memberData.markModified("mute"); memberData.save(); - message.success("moderation/unmute:SUCCESS", { username: member.user.tag }); + message.success("moderation/unmute:SUCCESS", { + username: member.user.tag + }); } else { - message.error("moderation/unmute:NOT_MUTED", { username: member.user.tag }); + message.error("moderation/unmute:NOT_MUTED", { + username: member.user.tag + }); }; } }; diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index dbead3b8..eb6748a6 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -2,27 +2,30 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Warn extends Command { - constructor (client) { + constructor(client) { super(client, { name: "warn", dirname: __dirname, enabled: true, guildOnly: true, aliases: [], - memberPermissions: [ "MANAGE_MESSAGES" ], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + memberPermissions: ["MANAGE_MESSAGES"], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.error("moderation/warn:MISSING_MEMBER"); + if (!member) return message.error("moderation/warn:MISSING_MEMBER"); if (member.user.bot) return message.error("misc:BOT_USER"); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); if (member.id === message.author.id) return message.error("moderation/warn:YOURSELF"); @@ -57,31 +60,61 @@ class Warn extends Command { if (banCount) { if (sanctions >= banCount) { - member.send(message.translate("moderation/ban:BANNED_DM", { username: member.user, moderator: message.author.tag, server: message.guild.name, reason })); + member.send(message.translate("moderation/ban:BANNED_DM", { + username: member.user, + moderator: message.author.tag, + server: message.guild.name, + reason + })); caseInfo.type = "ban"; - embed.setAuthor(message.translate("moderation/ban:CASE", { count: data.guild.casesCount })) + embed.setAuthor(message.translate("moderation/ban:CASE", { + count: data.guild.casesCount + })) .setColor("#e02316"); message.guild.members.ban(member).catch(() => {}); - message.success("moderation/setwarns:AUTO_BAN", { username: member.user.tag, count: banCount }); + message.success("moderation/setwarns:AUTO_BAN", { + username: member.user.tag, + count: banCount + }); }; }; if (kickCount) { if (sanctions >= kickCount) { - member.send(message.translate("moderation/kick:KICKED_DM", { username: member.user, moderator: message.author.tag, server: message.guild.name, reason })); + member.send(message.translate("moderation/kick:KICKED_DM", { + username: member.user, + moderator: message.author.tag, + server: message.guild.name, + reason + })); caseInfo.type = "kick"; - embed.setAuthor(message.translate("moderation/kick:CASE", { count: data.guild.casesCount })) + embed.setAuthor(message.translate("moderation/kick:CASE", { + count: data.guild.casesCount + })) .setColor("#e88709"); member.kick().catch(() => {}); - message.success("moderation/setwarns:AUTO_KICK", { username: member.user.tag, count: kickCount }); + message.success("moderation/setwarns:AUTO_KICK", { + username: member.user.tag, + count: kickCount + }); }; }; - member.send(message.translate("moderation/warn:WARNED_DM", { username: member.user.tag, server: message.guild.name, moderator: message.author.tag, reason })); + member.send(message.translate("moderation/warn:WARNED_DM", { + username: member.user.tag, + server: message.guild.name, + moderator: message.author.tag, + reason + })); caseInfo.type = "warn"; - embed.setAuthor(message.translate("moderation/warn:CASE", { caseNumber: data.guild.casesCount })) + embed.setAuthor(message.translate("moderation/warn:CASE", { + caseNumber: data.guild.casesCount + })) .setColor("#8c14e2"); - message.success("moderation/warn:WARNED", { username: member.user.tag, reason }); + message.success("moderation/warn:WARNED", { + username: member.user.tag, + reason + }); memberData.sanctions.push(caseInfo); memberData.save(); diff --git a/commands/Music/autoplay.js b/commands/Music/autoplay.js index ea80407b..34c68357 100644 --- a/commands/Music/autoplay.js +++ b/commands/Music/autoplay.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class AutoPlay extends Command { - constructor (client) { + constructor(client) { super(client, { name: "autoplay", dirname: __dirname, @@ -9,14 +9,14 @@ class AutoPlay extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message) { + async run(message) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/back.js b/commands/Music/back.js index 3c8ca2f1..093da521 100644 --- a/commands/Music/back.js +++ b/commands/Music/back.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Back extends Command { - constructor (client) { + constructor(client) { super(client, { name: "back", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "previous" ], + aliases: ["previous"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/clip.js b/commands/Music/clip.js index cfece0a1..6cba3a2a 100644 --- a/commands/Music/clip.js +++ b/commands/Music/clip.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), fs = require("fs"); class Clip extends Command { - constructor (client) { + constructor(client) { super(client, { name: "clip", dirname: __dirname, @@ -10,14 +10,14 @@ class Clip extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args) { + async run(message, args) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); const clip = args[0]; diff --git a/commands/Music/clips.js b/commands/Music/clips.js index 299b1d44..d956fd21 100644 --- a/commands/Music/clips.js +++ b/commands/Music/clips.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), fs = require("fs"); class Clips extends Command { - constructor (client) { + constructor(client) { super(client, { name: "clips", dirname: __dirname, @@ -11,20 +11,20 @@ class Clips extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { - fs.readdir("./clips", function(err, files) { + async run(message, args, data) { + fs.readdir("./clips", function (err, files) { if (err) return console.log("Unable to read directory: " + err); let clips = []; - files.forEach(function(file) { + files.forEach(function (file) { clips.push(file.substring(0, file.length - 4)); }); diff --git a/commands/Music/filter.js b/commands/Music/filter.js index deb24bc6..5ab903e9 100644 --- a/commands/Music/filter.js +++ b/commands/Music/filter.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js") class Filter extends Command { - constructor (client) { + constructor(client) { super(client, { name: "filter", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "f" ], + aliases: ["f"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); @@ -32,7 +32,9 @@ class Filter extends Command { } else if (Object.keys(this.client.player.filters).includes(args[0])) { queue.setFilter(args[0]); message.success("music/filter:ADDING_FILTER"); - } else if (args[0]) return message.error("music/filter:UNKNOWN_FILTER", { prefix: data.guild.prefix }); + } else if (args[0]) return message.error("music/filter:UNKNOWN_FILTER", { + prefix: data.guild.prefix + }); } }; diff --git a/commands/Music/filters.js b/commands/Music/filters.js index 7acb67d4..f77114fc 100644 --- a/commands/Music/filters.js +++ b/commands/Music/filters.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Filters extends Command { - constructor (client) { + constructor(client) { super(client, { name: "filters", dirname: __dirname, @@ -10,14 +10,14 @@ class Filters extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); @@ -32,7 +32,9 @@ class Filters extends Command { }); const list = new Discord.MessageEmbed() - .setDescription(message.translate("music/filters:CONTENT", { prefix: data.guild.prefix })) + .setDescription(message.translate("music/filters:CONTENT", { + prefix: data.guild.prefix + })) .addField(message.translate("music/filters:TITLE"), filtersStatuses[0].join("\n"), true) .addField("** **", filtersStatuses[1].join("\n"), true) .setColor(data.config.embed.color); diff --git a/commands/Music/jump.js b/commands/Music/jump.js index 5fb39a77..43ed8fff 100644 --- a/commands/Music/jump.js +++ b/commands/Music/jump.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Jump extends Command { - constructor (client) { + constructor(client) { super(client, { name: "jump", dirname: __dirname, @@ -10,14 +10,14 @@ class Jump extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const queue = this.client.player.getQueue(message); const voice = message.member.voice.channel; const number = parseInt(args[0]); @@ -35,7 +35,9 @@ class Jump extends Command { const m = await message.channel.send(embed); this.client.player.jump(message, number); - embed.setDescription(message.translate("music/play:NOW_PLAYING", { songName: queue.songs[number].name })); + embed.setDescription(message.translate("music/play:NOW_PLAYING", { + songName: queue.songs[number].name + })); m.edit(embed); } }; diff --git a/commands/Music/loop.js b/commands/Music/loop.js index 234ce986..77f92b25 100644 --- a/commands/Music/loop.js +++ b/commands/Music/loop.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Loop extends Command { - constructor (client) { + constructor(client) { super(client, { name: "loop", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "repeat" ], + aliases: ["repeat"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES" ], + botPermissions: ["SEND_MESSAGES"], nsfw: false, ownerOnly: false, cooldown: 1000 }); } - async run (message, args) { + async run(message, args) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/lyrics.js b/commands/Music/lyrics.js index 061cc5dd..73448d24 100644 --- a/commands/Music/lyrics.js +++ b/commands/Music/lyrics.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), lyricsParse = require("lyrics-finder"); class Lyrics extends Command { - constructor (client) { + constructor(client) { super(client, { name: "lyrics", dirname: __dirname, @@ -11,19 +11,21 @@ class Lyrics extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const [songName, artistName] = args.join(" ").split("|"); if (!songName) return message.error("music/lyrics:MISSING_SONG_NAME"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/lyrics:LYRICS_OF", { songName })) + .setAuthor(message.translate("music/lyrics:LYRICS_OF", { + songName + })) .setColor(data.config.embed.color) .setFooter(data.config.embed.footer); @@ -38,15 +40,19 @@ class Lyrics extends Command { if (lyrics.length > 2040) { lyrics = lyrics.substr(0, 2000) + message.translate("music/lyrics:AND_MORE") + "\n[" + message.translate("music/lyrics:CLICK_HERE") + "]" + `(https://www.musixmatch.com/search/${songName.replace(" ", "+")})`; } else if (!lyrics.length) { - return message.error("music/lyrics:NO_LYRICS_FOUND", { songName }); + return message.error("music/lyrics:NO_LYRICS_FOUND", { + songName + }); }; embed.setDescription(lyrics); message.channel.send(embed); - } catch(e) { + } catch (e) { console.log(e); - message.error("music/lyrics:NO_LYRICS_FOUND", { songName }); + message.error("music/lyrics:NO_LYRICS_FOUND", { + songName + }); } } }; diff --git a/commands/Music/np.js b/commands/Music/np.js index 31807ecb..f61905a2 100644 --- a/commands/Music/np.js +++ b/commands/Music/np.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Np extends Command { - constructor (client) { + constructor(client) { super(client, { name: "np", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "nowplaying", "now-playing" ], + aliases: ["nowplaying", "now-playing"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/pause.js b/commands/Music/pause.js index 746a2389..c018d40d 100644 --- a/commands/Music/pause.js +++ b/commands/Music/pause.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Pause extends Command { - constructor (client) { + constructor(client) { super(client, { name: "pause", dirname: __dirname, @@ -9,14 +9,14 @@ class Pause extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message) { + async run(message) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/play.js b/commands/Music/play.js index 7193fea3..43157ba7 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -1,22 +1,22 @@ const Command = require("../../base/Command.js"); class Play extends Command { - constructor (client) { + constructor(client) { super(client, { name: "play", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "p" ], + aliases: ["p"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args) { + async run(message, args) { const name = args.join(" "); if (!name) return message.error("music/play:MISSING_SONG_NAME"); @@ -30,7 +30,9 @@ class Play extends Command { try { this.client.player.play(message, args.join(" ")); } catch (e) { - message.error("music/play:ERR_OCCURRED", { error: e }); + message.error("music/play:ERR_OCCURRED", { + error: e + }); console.error(e); } } diff --git a/commands/Music/queue.js b/commands/Music/queue.js index e548940e..8d817087 100644 --- a/commands/Music/queue.js +++ b/commands/Music/queue.js @@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"), Pagination = require("discord-paginationembed"); class Queue extends Command { - constructor (client) { + constructor(client) { super(client, { name: "queue", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "playlist" ], + aliases: ["playlist"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); @@ -27,7 +27,9 @@ class Queue extends Command { if (queue.songs.length === 1) { const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ dynamic: true })) + .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ + dynamic: true + })) .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*Добавил ${queue.songs[0].member}*\n`) .setColor(data.config.embed.color); return message.channel.send(embed); @@ -37,7 +39,9 @@ class Queue extends Command { FieldsEmbed.embed .setColor(data.config.embed.color) - .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ dynamic: true })) + .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ + dynamic: true + })) .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*Добавил ${queue.songs[0].member}*\n`); FieldsEmbed.setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : []) diff --git a/commands/Music/resume.js b/commands/Music/resume.js index 67b28b85..c6fad087 100644 --- a/commands/Music/resume.js +++ b/commands/Music/resume.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Resume extends Command { - constructor (client) { + constructor(client) { super(client, { name: "resume", dirname: __dirname, @@ -9,14 +9,14 @@ class Resume extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message) { + async run(message) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/seek.js b/commands/Music/seek.js index c9d30bcb..c6e65c31 100644 --- a/commands/Music/seek.js +++ b/commands/Music/seek.js @@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"); const ms = require("ms"); class Seek extends Command { - constructor (client) { + constructor(client) { super(client, { name: "seek", dirname: __dirname, @@ -10,14 +10,14 @@ class Seek extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args) { + async run(message, args) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); diff --git a/commands/Music/skip.js b/commands/Music/skip.js index f584ff47..c2a821f3 100644 --- a/commands/Music/skip.js +++ b/commands/Music/skip.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Skip extends Command { - constructor (client) { + constructor(client) { super(client, { name: "skip", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "next" ], + aliases: ["next"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); @@ -34,7 +34,9 @@ class Skip extends Command { const m = await message.channel.send(embed); this.client.player.skip(message); - embed.setDescription(message.translate("music/play:NOW_PLAYING", { songName: queue.songs[1].name })); + embed.setDescription(message.translate("music/play:NOW_PLAYING", { + songName: queue.songs[1].name + })); m.edit(embed); } }; diff --git a/commands/Music/stop.js b/commands/Music/stop.js index 86dc75fb..e9de4d50 100644 --- a/commands/Music/stop.js +++ b/commands/Music/stop.js @@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class Stop extends Command { - constructor (client) { + constructor(client) { super(client, { name: "stop", dirname: __dirname, enabled: true, guildOnly: true, - aliases: [ "leave" ], + aliases: ["leave"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: false, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const voice = message.member.voice.channel; const queue = await this.client.player.getQueue(message); diff --git a/commands/NSFW/hentai.js b/commands/NSFW/hentai.js index 6843fedd..03e8ff7e 100644 --- a/commands/NSFW/hentai.js +++ b/commands/NSFW/hentai.js @@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"), fetch = require("node-fetch"); class Hentai extends Command { - constructor (client) { + constructor(client) { super(client, { name: "hentai", dirname: __dirname, @@ -11,14 +11,14 @@ class Hentai extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], nsfw: true, ownerOnly: false, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { const category = args[0]; var gif = null; const embed = new Discord.MessageEmbed() @@ -26,71 +26,74 @@ class Hentai extends Command { .setFooter(data.config.embed.footer) .setTimestamp() - switch(category) { + switch (category) { case "neko": gif = await fetch("https://nekos.life/api/v2/img/nsfw_neko_gif").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "cum": gif = await fetch("https://nekos.life/api/v2/img/cum").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "solo": gif = await fetch("https://nekos.life/api/v2/img/solo").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "anal": gif = await fetch("https://nekos.life/api/v2/img/anal").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "yuri": gif = await fetch("https://nekos.life/api/v2/img/yuri").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "blowjob": gif = await fetch("https://nekos.life/api/v2/img/bj").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "bj": gif = await fetch("https://nekos.life/api/v2/img/bj").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "pussy": gif = await fetch("https://nekos.life/api/v2/img/pussy").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "classic": gif = await fetch("https://nekos.life/api/v2/img/hentai").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "futa": gif = await fetch("https://nekos.life/api/v2/img/futanari").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "futanari": gif = await fetch("https://nekos.life/api/v2/img/futanari").then(response => response.json()); embed.setImage(gif.url) - break; + break; case "help": embed.setTitle(message.translate("nsfw/hentai:HELP_1")) embed.setDescription(message.translate("nsfw/hentai:HELP_2")) - break; + break; default: gif = await fetch("https://nekos.life/api/v2/img/Random_hentai_gif").then(response => response.json()); embed.setImage(gif.url) - embed.setDescription(message.translate("nsfw/hentai:NOCATEGORY", { prefix: data.guild.prefix })) + embed.setDescription(message.translate("nsfw/hentai:NOCATEGORY", { + prefix: data.guild.prefix + })) + break; }; message.channel.send(embed); } diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js index 7d75ab01..7f7e2e24 100644 --- a/commands/Owner/debug.js +++ b/commands/Owner/debug.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Debug extends Command { - constructor (client) { + constructor(client) { super(client, { name: "debug", dirname: __dirname, @@ -9,14 +9,14 @@ class Debug extends Command { guildOnly: true, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES" ], + botPermissions: ["SEND_MESSAGES"], nsfw: false, ownerOnly: true, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { const action = args[0]; if (!action || !["set", "add"].includes(action)) return message.error("owner/debug:NO_ACTION"); @@ -31,7 +31,10 @@ class Debug extends Command { if (!number || isNaN(number)) return message.error("owner/debug:INVALID_AMOUNT"); const amount = Math.ceil(parseInt(number, 10)); - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: message.guild.id + }); var newValue = 0; @@ -54,7 +57,10 @@ class Debug extends Command { memberData.save(); }; - message.success("owner/debug:SET_" + status.toUpperCase() , { username: member.user.tag, amount }); + message.success("owner/debug:SET_" + status.toUpperCase(), { + username: member.user.tag, + amount + }); } else if (action === "add") { if (status === "level") { newValue = memberData.level + parseInt(amount, 10); @@ -78,7 +84,10 @@ class Debug extends Command { memberData.save(); }; - message.success("owner/debug:SUCCESS_" + status.toUpperCase() , { username: member.user.tag, amount: newValue}); + message.success("owner/debug:SUCCESS_" + status.toUpperCase(), { + username: member.user.tag, + amount: newValue + }); }; } }; diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index 801f5764..58651349 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Eval extends Command { - constructor (client) { + constructor(client) { super(client, { name: "eval", dirname: __dirname, @@ -9,7 +9,7 @@ class Eval extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: true, cooldown: 2000 @@ -17,7 +17,7 @@ class Eval extends Command { } // eslint-disable-next-line no-unused-vars - async run (message, args, data) { + async run(message, args, data) { // eslint-disable-next-line no-unused-vars const usersData = this.client.usersData; // eslint-disable-next-line no-unused-vars @@ -27,14 +27,20 @@ class Eval extends Command { const result = new Promise((resolve) => resolve(eval(content))); return result.then((output) => { - if (typeof output != "string") output = require("util").inspect(output, { depth: 0 }); + if (typeof output != "string") output = require("util").inspect(output, { + depth: 0 + }); if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N"); - message.channel.send(output, { code: "js" }); + message.channel.send(output, { + code: "js" + }); }).catch((err) => { console.error(err); err = err.toString(); if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N"); - message.channel.send(err, { code: "js" }); + message.channel.send(err, { + code: "js" + }); }); } }; diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js index bfc33852..f5c2d2d7 100644 --- a/commands/Owner/reload.js +++ b/commands/Owner/reload.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Reload extends Command { - constructor (client) { + constructor(client) { super(client, { name: "reload", dirname: __dirname, @@ -16,14 +16,16 @@ class Reload extends Command { }); } - async run (message, args) { + async run(message, args) { const command = args[0]; const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command)); if (!cmd) message.error("owner/reload:NOT_FOUND", { search: command }); await this.client.unloadCommand(cmd.conf.location, cmd.help.name); await this.client.loadCommand(cmd.conf.location, cmd.help.name); - message.success("owner/reload:SUCCESS", { command: cmd.help.name }); + message.success("owner/reload:SUCCESS", { + command: cmd.help.name + }); } }; diff --git a/commands/Owner/say.js b/commands/Owner/say.js index 24f7e18a..9a40eb2f 100644 --- a/commands/Owner/say.js +++ b/commands/Owner/say.js @@ -1,7 +1,7 @@ const Command = require("../../base/Command.js"); class Say extends Command { - constructor (client) { + constructor(client) { super(client, { name: "say", dirname: __dirname, @@ -9,14 +9,14 @@ class Say extends Command { guildOnly: false, aliases: [], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES" ], + botPermissions: ["SEND_MESSAGES"], nsfw: false, ownerOnly: true, cooldown: 2000 }); } - async run (message, args, data) { + async run(message, args, data) { if (!args[0]) return message.delete(); // Arguments split @@ -31,8 +31,10 @@ class Say extends Command { const saychannel = message.guild.channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]); saychannel.startTyping(); - setTimeout(function() { - if (attachment) saychannel.send(args[0], { files: [ attachment ] }); + setTimeout(function () { + if (attachment) saychannel.send(args[0], { + files: [attachment] + }); else saychannel.send(args[0]); saychannel.stopTyping(); }, 2000); @@ -40,8 +42,10 @@ class Say extends Command { const saychannel = this.client.guilds.cache.find(guild => guild.name == args[2] || guild.id == args[2]).channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]); saychannel.startTyping(); - setTimeout(function() { - if (attachment) saychannel.send(args[0], { files: [ attachment ] }); + setTimeout(function () { + if (attachment) saychannel.send(args[0], { + files: [attachment] + }); else saychannel.send(args[0]); saychannel.stopTyping(); }, 2000); @@ -50,8 +54,10 @@ class Say extends Command { const saychannel = message.channel; saychannel.startTyping(); - setTimeout(function() { - if (attachment) saychannel.send(args[0], { files: [ attachment ] }); + setTimeout(function () { + if (attachment) saychannel.send(args[0], { + files: [attachment] + }); else saychannel.send(args[0]); saychannel.stopTyping(); }, 2000); diff --git a/commands/Owner/servers-list.js b/commands/Owner/servers-list.js index 5f8825df..a288c9ff 100644 --- a/commands/Owner/servers-list.js +++ b/commands/Owner/servers-list.js @@ -2,36 +2,40 @@ const Command = require("../../base/Command.js"), Discord = require("discord.js"); class ServersList extends Command { - constructor (client) { + constructor(client) { super(client, { name: "servers-list", dirname: __dirname, enabled: true, guildOnly: false, - aliases: [ "slist" ], + aliases: ["slist"], memberPermissions: [], - botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], + botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], nsfw: false, ownerOnly: true, cooldown: 3000 }); } - async run (message, args, data) { + async run(message, args, data) { if (!message.channel.type != "dm") message.delete(); - let i0 = 0; - let i1 = 10; - let page = 1; + let i0 = 0, + i1 = 10, + page = 1; let description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache.sort((a,b) => b.memberCount - a.memberCount).map((r) => r) + this.client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).map((r) => r) .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`) .slice(0, 10) .join("\n"); const embed = new Discord.MessageEmbed() - .setAuthor(message.author.tag, message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) + .setAuthor(message.author.tag, message.author.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + })) .setColor(data.config.embed.color) .setFooter(this.client.user.username) .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.ceil(this.client.guilds.cache.size/10)}`) @@ -45,7 +49,7 @@ class ServersList extends Command { const collector = msg.createReactionCollector((reaction, user) => user.id === message.author.id); - collector.on("collect", async(reaction) => { + collector.on("collect", async (reaction) => { if (reaction._emoji.name === "⬅") { // Updates variables i0 = i0 - 10; @@ -57,7 +61,7 @@ class ServersList extends Command { if (!i0 || !i1) return msg.delete(); description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r) + this.client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).map((r) => r) .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS")}`) .slice(i0, i1) .join("\n"); @@ -81,7 +85,7 @@ class ServersList extends Command { if (!i0 || !i1) return msg.delete(); description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r) + this.client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).map((r) => r) .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`) .slice(i0, i1) .join("\n"); diff --git a/config.sample.js b/config.sample.js index 5682ccd4..0b1997ea 100644 --- a/config.sample.js +++ b/config.sample.js @@ -3,6 +3,8 @@ module.exports = { token: "XXXXXXXXXXX", /* Youtube token */ youtubeToken: "XXXXXXXXXXX", + /* Your Github API token for private repos */ + githubToken: "XXXXXXXXXXX", /* For the support server */ support: { id: "XXXXXXXXXXX", // The ID of the support server diff --git a/events/guildCreate.js b/events/guildCreate.js index cabb1ee7..70a7a254 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -1,11 +1,11 @@ const Discord = require("discord.js"); module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (guild) { + async run(guild) { if (this.client.config.proMode) { if ((!this.client.config.proUsers.includes(guild.ownerID) || this.guilds.filter((g) => g.ownerID === guild.ownerID) > 1) && guild.ownerID !== this.client.config.owner.id) { this.client.logger.log(`${guild.ownerID} tried to invite JaBa on its server.`); @@ -15,11 +15,16 @@ module.exports = class { const messageOptions = {}; - const userData = await this.client.findOrCreateUser({ id: guild.ownerID }); + const userData = await this.client.findOrCreateUser({ + id: guild.ownerID + }); if (!userData.achievements.invite.achieved) { userData.achievements.invite.progress.now += 1; userData.achievements.invite.achieved = true; - messageOptions.files = [{ name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked7.png" }]; + messageOptions.files = [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked7.png" + }]; userData.markModified("achievements.invite"); await userData.save(); }; diff --git a/events/guildDelete.js b/events/guildDelete.js index 8904e380..ccc393a1 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -1,11 +1,11 @@ const Discord = require("discord.js"); module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (guild) { + async run(guild) { const text = `Вышел с сервера **${guild.name}**. На нём **${guild.members.cache.filter((m) => !m.user.bot).size}** пользователей (из них ${guild.members.cache.filter((m) => m.user.bot).size} ботов)`; // Sends log embed in the logs channel diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 6eb050d4..1d3fb1f9 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -16,17 +16,22 @@ const applyText = (canvas, text, defaultFontSize) => { }; module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (member) { + async run(member) { await member.guild.members.fetch(); - const guildData = await this.client.findOrCreateGuild({ id: member.guild.id }); + const guildData = await this.client.findOrCreateGuild({ + id: member.guild.id + }); member.guild.data = guildData; - const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: member.guild.id }); + const memberData = await this.client.findOrCreateMember({ + id: member.id, + guildID: member.guild.id + }); if (memberData.mute.muted && memberData.mute.endDate > Date.now()) { member.guild.channels.cache.forEach((channel) => { channel.updateOverwrite(member.id, { @@ -55,8 +60,10 @@ module.exports = class { // Background image const background = await Canvas.loadImage("./assets/img/greetings_background.png"); + // This uses the canvas dimensions to stretch the image onto the entire canvas ctx.drawImage(background, 0, 0, canvas.width, canvas.height); + // Draw username ctx.fillStyle = "#ffffff"; const username = stringCleaner(member.user.username, { @@ -67,6 +74,7 @@ module.exports = class { }); ctx.font = applyText(canvas, username, 50); ctx.fillText(username, canvas.width - 660, canvas.height - 250); + // Draw server name ctx.font = applyText(canvas, member.guild.translate("administration/welcome:IMG_WELCOME", { server: member.guild.name @@ -74,23 +82,28 @@ module.exports = class { ctx.fillText(member.guild.translate("administration/welcome:IMG_WELCOME", { server: member.guild.name }), canvas.width - 690, canvas.height - 85); + // Draw discriminator ctx.font = "35px RubikMonoOne"; ctx.fillText(member.user.discriminator, canvas.width - 624, canvas.height - 180); + // Draw number ctx.font = "22px RubikMonoOne"; ctx.fillText(member.guild.translate("administration/welcome:IMG_NB", { memberCount: member.guild.memberCount }), 50, canvas.height - 50); + // Draw # for discriminator ctx.fillStyle = "#44d14a"; ctx.font = "70px RubikMonoOne"; ctx.fillText("#", canvas.width - 690, canvas.height - 165); + // Draw Title with gradient ctx.font = "65px RubikMonoOne"; ctx.strokeStyle = "#1d2124"; ctx.lineWidth = 15; ctx.strokeText(member.guild.translate("administration/welcome:TITLE"), canvas.width - 670, canvas.height - 330); + var gradient = ctx.createLinearGradient(canvas.width - 780, 0, canvas.width - 30, 0); gradient.addColorStop(0, "#e15500"); gradient.addColorStop(1, "#e7b121"); @@ -99,22 +112,32 @@ module.exports = class { // Pick up the pen ctx.beginPath(); + //Define Stroke Line ctx.lineWidth = 10; + //Define Stroke Style ctx.strokeStyle = "#03A9F4"; + // Start the arc to form a circle ctx.arc(180, 225, 135, 0, Math.PI * 2, true); + // Draw Stroke ctx.stroke(); + // Put the pen down ctx.closePath(); + // Clip off the region you drew on ctx.clip(); - const options = { format: "png", size: 512 }, + const options = { + format: "png", + size: 512 + }, avatar = await Canvas.loadImage(member.user.displayAvatarURL(options)); - // Move the image downwards vertically and constrain its height to 200, so it"s a square + + // Move the image downwards vertically and constrain its height to 200, so it"s a square ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "welcome-image.png"); diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index d5df6d6a..cc28a463 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -16,14 +16,16 @@ const applyText = (canvas, text, defaultFontSize) => { }; module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (member) { + async run(member) { await member.guild.members.fetch(); - const guildData = await this.client.findOrCreateGuild({ id: member.guild.id }); + const guildData = await this.client.findOrCreateGuild({ + id: member.guild.id + }); member.guild.data = guildData; // Check if goodbye message is enabled @@ -41,8 +43,10 @@ module.exports = class { // Background image const background = await Canvas.loadImage("./assets/img/greetings_background.png"); + // This uses the canvas dimensions to stretch the image onto the entire canvas ctx.drawImage(background, 0, 0, canvas.width, canvas.height); + // Draw username ctx.fillStyle = "#ffffff"; const username = stringCleaner(member.user.username, { @@ -53,6 +57,7 @@ module.exports = class { }); ctx.font = applyText(canvas, username, 50); ctx.fillText(username, canvas.width - 660, canvas.height - 250); + // Draw server name ctx.font = applyText(canvas, member.guild.translate("administration/goodbye:IMG_GOODBYE", { server: member.guild.name @@ -60,6 +65,7 @@ module.exports = class { ctx.fillText(member.guild.translate("administration/goodbye:IMG_GOODBYE", { server: member.guild.name }), canvas.width - 690, canvas.height - 65); + // Draw discriminator ctx.font = "35px RubikMonoOne"; ctx.fillText(member.user.discriminator, canvas.width - 624, canvas.height - 180); @@ -68,15 +74,18 @@ module.exports = class { ctx.fillText(member.guild.translate("administration/goodbye:IMG_NB", { memberCount: member.guild.memberCount }), 50, canvas.height - 50); + // Draw # for discriminator ctx.fillStyle = "#44d14a"; ctx.font = "70px RubikMonoOne"; ctx.fillText("#", canvas.width - 690, canvas.height - 165); + // Draw Title with gradient ctx.font = "65px RubikMonoOne"; ctx.strokeStyle = "#1d2124"; ctx.lineWidth = 15; ctx.strokeText(member.guild.translate("administration/goodbye:TITLE"), canvas.width - 670, canvas.height - 330); + var gradient = ctx.createLinearGradient(canvas.width - 780, 0, canvas.width - 30, 0); gradient.addColorStop(0, "#e15500"); gradient.addColorStop(1, "#e7b121"); @@ -85,22 +94,32 @@ module.exports = class { // Pick up the pen ctx.beginPath(); + //Define Stroke Line ctx.lineWidth = 10; + //Define Stroke Style ctx.strokeStyle = "#df0909"; + // Start the arc to form a circle ctx.arc(180, 225, 135, 0, Math.PI * 2, true); + // Draw Stroke ctx.stroke(); + // Put the pen down ctx.closePath(); + // Clip off the region you drew on ctx.clip(); - const options = { format: "png", size: 512 }, + const options = { + format: "png", + size: 512 + }, avatar = await Canvas.loadImage(member.user.displayAvatarURL(options)); - // Move the image downwards vertically and constrain its height to 200, so it"s a square + + // Move the image downwards vertically and constrain its height to 200, so it"s a square ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "goodbye-image.png"); diff --git a/events/guildMemberUpdate.js b/events/guildMemberUpdate.js index 3dceef5e..a4f83a6c 100644 --- a/events/guildMemberUpdate.js +++ b/events/guildMemberUpdate.js @@ -1,19 +1,26 @@ module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (oldMember, newMember) { + async run(oldMember, newMember) { if (oldMember.guild.id !== this.client.config.support.id) return; if (oldMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) return; if (newMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) { - const userData = await this.client.findOrCreateUser({ id: newMember.id }); + const userData = await this.client.findOrCreateUser({ + id: newMember.id + }); userData.achievements.tip.progress.now = 1; userData.achievements.tip.achieved = true; userData.markModified("achievements.tip"); await userData.save(); - newMember.send({ files: [{ name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked5.png"} ]}); + newMember.send({ + files: [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked5.png" + }] + }); }; } }; \ No newline at end of file diff --git a/events/message.js b/events/message.js index 6eff3378..26503715 100644 --- a/events/message.js +++ b/events/message.js @@ -2,11 +2,11 @@ const xpCooldown = {}, cmdCooldown = {}; module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (message) { + async run(message) { const data = {}; // If the message author is a bot @@ -20,7 +20,9 @@ module.exports = class { if (message.guild) { // Gets guild data - const guild = await client.findOrCreateGuild({ id: message.guild.id }); + const guild = await client.findOrCreateGuild({ + id: message.guild.id + }); message.guild.data = data.guild = guild; }; @@ -34,11 +36,16 @@ module.exports = class { if (message.guild) { // Gets the data of the member - const memberData = await client.findOrCreateMember({ id: message.author.id, guildID: message.guild.id }); + const memberData = await client.findOrCreateMember({ + id: message.author.id, + guildID: message.guild.id + }); data.memberData = memberData; }; - const userData = await client.findOrCreateUser({ id: message.author.id }); + const userData = await client.findOrCreateUser({ + id: message.author.id + }); data.userData = userData; if (message.guild) { @@ -53,7 +60,10 @@ module.exports = class { message.delete(); const delay = message.convertTime(uSlowmode.time, "to", true); - return message.author.send(message.translate("administration/slowmode:PLEASE_WAIT", { time: delay, channel: message.channel.toString() })); + return message.author.send(message.translate("administration/slowmode:PLEASE_WAIT", { + time: delay, + channel: message.channel.toString() + })); } else { uSlowmode.time = channelSlowmode.time + Date.now(); }; @@ -73,7 +83,9 @@ module.exports = class { if (!message.channel.permissionsFor(message.member).has("MANAGE_MESSAGES")) { message.delete(); message.author.send("```" + message.content + "```"); - return message.error("administration/automod:DELETED", { username: message.author.tag }); + return message.error("administration/automod:DELETED", { + username: message.author.tag + }); }; }; }; @@ -82,12 +94,19 @@ module.exports = class { if (afkReason) { data.userData.afk = null; await data.userData.save(); - message.sendT("general/setafk:DELETED", { username: message.author.username }); + message.sendT("general/setafk:DELETED", { + username: message.author.username + }); }; message.mentions.users.forEach(async (u) => { - const userData = await client.findOrCreateUser({ id: u.id }); - if (userData.afk) message.error("general/setafk:IS_AFK", { user: u.tag, reason: userData.afk }); + const userData = await client.findOrCreateUser({ + id: u.id + }); + if (userData.afk) message.error("general/setafk:IS_AFK", { + user: u.tag, + reason: userData.afk + }); }); }; @@ -107,9 +126,9 @@ module.exports = class { if (message.guild && data.guild.ignoredChannels.includes(message.channel.id) && !message.member.hasPermission("MANAGE_MESSAGES")) { message.delete(); - message.author.send(message.translate("misc:RESTRICTED_CHANNEL", { channel: message.channel.toString() })); - - return; + return message.author.send(message.translate("misc:RESTRICTED_CHANNEL", { + channel: message.channel.toString() + })); }; if (customCommandAnswer) return message.channel.send(customCommandAnswer); @@ -125,7 +144,9 @@ module.exports = class { }; }); - if (neededPermissions.length > 0) return message.error("misc:MISSING_BOT_PERMS", { list: neededPermissions.map((p) => `\`${p}\``).join(", ") }); + if (neededPermissions.length > 0) return message.error("misc:MISSING_BOT_PERMS", { + list: neededPermissions.map((p) => `\`${p}\``).join(", ") + }); neededPermissions = []; cmd.conf.memberPermissions.forEach((perm) => { @@ -149,15 +170,22 @@ module.exports = class { }; const time = uCooldown[cmd.help.name] || 0; - if (time && (time > Date.now())) return message.error("misc:COOLDOWNED", { seconds: Math.ceil((time-Date.now())/1000) }); + if (time && (time > Date.now())) return message.error("misc:COOLDOWNED", { seconds: Math.ceil((time - Date.now()) / 1000) }); cmdCooldown[message.author.id][cmd.help.name] = Date.now() + cmd.conf.cooldown; client.logger.log(`${message.author.username} (${message.author.id}) ran command ${cmd.help.name} ${message.guild ? `on ${message.guild.name}` : "in DM"}`, "cmd"); const log = new this.client.logs({ commandName: cmd.help.name, - author: { username: message.author.username, discriminator: message.author.discriminator, id: message.author.id }, - guild: { name: message.guild ? message.guild.name : "dm", id: message.guild ? message.guild.id : "dm" } + author: { + username: message.author.username, + discriminator: message.author.discriminator, + id: message.author.id + }, + guild: { + name: message.guild ? message.guild.name : "dm", + id: message.guild ? message.guild.id : "dm" + } }); log.save(); @@ -166,16 +194,18 @@ module.exports = class { data.userData.achievements.firstCommand.achieved = true; data.userData.markModified("achievements.firstCommand"); await data.userData.save(); - await message.channel.send({ files: [{ - name: "unlocked.png", - attachment: "./assets/img/achievements/achievement_unlocked2.png" - }]}); + await message.channel.send({ + files: [{ + name: "unlocked.png", + attachment: "./assets/img/achievements/achievement_unlocked2.png" + }] + }); }; try { cmd.run(message, args, data); if (cmd.help.category === "Moderation" && data.guild.autoDeleteModCommands) message.delete(); - } catch(e) { + } catch (e) { console.error(e); return message.error("misc:ERR_OCCURRED"); }; @@ -185,7 +215,7 @@ module.exports = class { /** * updateXp * This function update userdata by adding xp -*/ + */ async function updateXp(msg, data) { // Gets the user informations const points = parseInt(data.memberData.exp); diff --git a/events/messageUpdate.js b/events/messageUpdate.js index 3a83894c..a354632c 100644 --- a/events/messageUpdate.js +++ b/events/messageUpdate.js @@ -1,9 +1,9 @@ module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run (oldMessage, newMessage) { + async run(oldMessage, newMessage) { if (!newMessage.editedAt) return; this.client.emit("message", newMessage); } diff --git a/events/ready.js b/events/ready.js index cd014ee1..45f6844d 100644 --- a/events/ready.js +++ b/events/ready.js @@ -1,16 +1,17 @@ const chalk = require("chalk"); module.exports = class { - constructor (client) { + constructor(client) { this.client = client; } - async run () { + async run() { const client = this.client; // Logs some informations using logger client.logger.log(`Loading a total of ${client.commands.size} command(s).`, "log"); client.logger.log(`${client.user.tag}, ready to serve ${client.users.cache.size} users in ${client.guilds.cache.filter(guild => guild.id != "568120814776614924" && guild.id != "892727526911258654").size} servers.`, "ready"); + client.logger.log(`Invite Link: https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`); // Discord Together const discordtogether = require("../helpers/discordTogether"); @@ -37,17 +38,20 @@ module.exports = class { // Update status every 20s let servers = client.guilds.cache.filter(guild => guild.id != "568120814776614924" && guild.id != "892727526911258654").size; + const version = require("../package.json").version; const status = [ { name: `${servers} ${getNoun(servers, "сервер", "сервера", "серверов")}`, type: "WATCHING" }, { name: "help", type: "WATCHING" } ]; - const version = require("../package.json").version; + let i = 0; - setInterval(function() { + setInterval(function () { servers = client.guilds.cache.filter(guild => guild.id != "568120814776614924" && guild.id != "892727526911258654").size; const random = status[parseInt(i, 10)]; - const toDisplay = `${random.name} | v${version}` - client.user.setActivity(toDisplay, { type: random.type }); + + client.user.setActivity(`${random.name} | v${version}`, { + type: random.type + }); if (status[parseInt(i + 1, 10)]) i++; else i = 0; diff --git a/helpers/autoUpdateDocs.js b/helpers/autoUpdateDocs.js index 88d66f2e..75d66a58 100644 --- a/helpers/autoUpdateDocs.js +++ b/helpers/autoUpdateDocs.js @@ -22,11 +22,11 @@ module.exports = { // }) categories.sort().forEach((cat) => { const arrCat = [ - [ "Название", "Описание", "Использование", "Откат" ] + ["Название", "Описание", "Использование", "Откат"] ]; const cmds = commands.filter((cmd) => cmd.help.category === cat).array(); text += `### ${cat} (${cmds.length} ${getNoun(cmds.length, "команда", "команды", "команд")})\n\n`; - cmds.sort(function(a, b) { + cmds.sort(function (a, b) { if (a.help.name < b.help.name) return -1; else return 1; }).forEach((cmd) => { diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 85e523e5..312dcc14 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -7,13 +7,15 @@ module.exports = { * @param {object} client The Discord Client instance */ init(client) { - client.usersData.find({ reminds: { $gt : [] } }).then((users) => { - for (const user of users) { - if (!client.users.cache.has(user.id)) client.users.fetch(user.id); - client.databaseCache.usersReminds.set(user.id, user); - }; - }); - setInterval(async function() { + client.usersData + .find({ reminds: { $gt: [] } }) + .then((users) => { + for (const user of users) { + if (!client.users.cache.has(user.id)) client.users.fetch(user.id); + client.databaseCache.usersReminds.set(user.id, user); + }; + }); + setInterval(async function () { const dateNow = Date.now(); client.databaseCache.usersReminds.forEach(async (user) => { const dUser = client.users.cache.get(user.id); diff --git a/helpers/checkUnmutes.js b/helpers/checkUnmutes.js index ebeb11fe..dc755be1 100644 --- a/helpers/checkUnmutes.js +++ b/helpers/checkUnmutes.js @@ -7,11 +7,13 @@ module.exports = { * @param {object} client The Discord Client instance */ async init(client) { - client.membersData.find({ "mute.muted": true }).then((members) => { - members.forEach((member) => { - client.databaseCache.mutedUsers.set(`${member.id}${member.guildID}`, member); + client.membersData + .find({ "mute.muted": true }) + .then((members) => { + members.forEach((member) => { + client.databaseCache.mutedUsers.set(`${member.id}${member.guildID}`, member); + }); }); - }); setInterval(async () => { client.databaseCache.mutedUsers.array().filter((m) => m.mute.endDate <= Date.now()).forEach(async (memberData) => { const guild = client.guilds.cache.get(memberData.guildID); @@ -27,7 +29,9 @@ module.exports = { return null; }); - const guildData = await client.findOrCreateGuild({ id: guild.id }); + const guildData = await client.findOrCreateGuild({ + id: guild.id + }); guild.data = guildData; if (member) { guild.channels.cache.forEach((channel) => { diff --git a/helpers/discordbots.org.js b/helpers/discordbots.org.js index 9f405a95..8ba67fbb 100644 --- a/helpers/discordbots.org.js +++ b/helpers/discordbots.org.js @@ -9,13 +9,19 @@ module.exports = { init(client) { if (client.config.apiKeys.dbl && client.config.apiKeys.dbl !== "") { const stats = new DBL(client.config.apiKeys.dbl, client); - setInterval(function() { + setInterval(function () { stats.postStats(client.guilds.cache.size); }, 10 * 60000); // every 10 minutes - const dbl = new DBL(client.config.apiKeys.dbl, { webhookPort: client.config.votes.port, webhookAuth: client.config.votes.password }); + const dbl = new DBL(client.config.apiKeys.dbl, { + webhookPort: client.config.votes.port, + webhookAuth: client.config.votes.password + }); dbl.webhook.on("vote", async (vote) => { const dUser = await client.users.fetch(vote.user); - const member = await client.findOrCreateMember({ id: vote.user, guildID: client.config.support.id }); + const member = await client.findOrCreateMember({ + id: vote.user, + guildID: client.config.support.id + }); member.money = member.money + 40; member.save(); dUser.send(client.translate("misc:VOTE_DM", { @@ -23,7 +29,10 @@ module.exports = { })).catch(() => {}); const logsChannel = client.channels.cache.get(client.config.votes.channel); - if (logsChannel) logsChannel.send(client.translate("misc:VOTE_LOGS", { userid: dUser.id, usertag: dUser.tag })); + if (logsChannel) logsChannel.send(client.translate("misc:VOTE_LOGS", { + userid: dUser.id, + usertag: dUser.tag + })); }); }; } diff --git a/helpers/extenders.js b/helpers/extenders.js index 43e9866e..a594e72b 100644 --- a/helpers/extenders.js +++ b/helpers/extenders.js @@ -1,14 +1,14 @@ const { Guild, Message, MessageEmbed } = require("discord.js"); const config = require("../config"); -Guild.prototype.translate = function(key, args) { +Guild.prototype.translate = function (key, args) { const language = this.client.translations.get(this.data.language); if (!language) throw "Message: Invalid language set in data."; return language(key, args); }; -Message.prototype.translate = function(key, args) { +Message.prototype.translate = function (key, args) { const language = this.client.translations.get(this.guild ? this.guild.data.language : "ru-RU"); if (!language) throw "Message: Invalid language set in data."; @@ -16,21 +16,21 @@ Message.prototype.translate = function(key, args) { }; // Wrapper for sendT with error emoji -Message.prototype.error = function(key, args, options = {}) { +Message.prototype.error = function (key, args, options = {}) { options.prefixEmoji = "error"; return this.sendT(key, args, options); }; // Wrapper for sendT with success emoji -Message.prototype.success = function(key, args, options = {}) { +Message.prototype.success = function (key, args, options = {}) { options.prefixEmoji = "success"; return this.sendT(key, args, options); }; // Translate and send the message -Message.prototype.sendT = function(key, args, options = {}) { +Message.prototype.sendT = function (key, args, options = {}) { let string = this.translate(key, args); if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`; @@ -39,28 +39,28 @@ Message.prototype.sendT = function(key, args, options = {}) { }; // Format a date -Message.prototype.printDate = function(date, format) { +Message.prototype.printDate = function (date, format) { return this.client.printDate(date, format, this.guild.data.language); }; // Convert time -Message.prototype.convertTime = function(time, type, noPrefix) { +Message.prototype.convertTime = function (time, type, noPrefix) { return this.client.convertTime(time, type, noPrefix, (this.guild && this.guild.data) ? this.guild.data.language : null); }; -MessageEmbed.prototype.errorColor = function() { +MessageEmbed.prototype.errorColor = function () { this.setColor("#FF0000"); return this; }; -MessageEmbed.prototype.successColor = function() { +MessageEmbed.prototype.successColor = function () { this.setColor("#32CD32"); return this; }; -MessageEmbed.prototype.defaultColor = function() { +MessageEmbed.prototype.defaultColor = function () { this.setColor(config.color); return this; diff --git a/helpers/fortniteShop.js b/helpers/fortniteShop.js index 229feb65..878c102a 100644 --- a/helpers/fortniteShop.js +++ b/helpers/fortniteShop.js @@ -3,11 +3,13 @@ const Canvas = require("discord-canvas"), Discord = require("discord.js"); async function init(client) { - new CronJob("0 3 12 * * *", async function() { + new CronJob("0 0 12 * * *", async function () { if (!client.config.apiKeys.fortniteFNBR || client.config.apiKeys.fortniteFNBR === "") return; client.guilds.cache.forEach(async (guild) => { - const guildData = await client.findOrCreateGuild({ id: guild.id }); + const guildData = await client.findOrCreateGuild({ + id: guild.id + }); if (guildData.plugins.fortniteshop) { const fnChannel = client.channels.cache.get(guildData.plugins.fortniteshop); if (fnChannel) { diff --git a/helpers/functions.js b/helpers/functions.js index 450e9ca5..60291346 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -34,7 +34,9 @@ module.exports = { const member = guild.me; const channel = guild.channels.cache.find((ch) => ch.permissionsFor(member.id).has("CREATE_INSTANT_INVITE") && ch.type === "text" || ch.type === "voice"); if (channel) { - const invite = await channel.createInvite({ maxAge: 0 }).catch(() => {}); + const invite = await channel.createInvite({ + maxAge: 0 + }).catch(() => {}); return invite ? invite.url : null; } else { @@ -44,7 +46,7 @@ module.exports = { // This function sort an array sortByKey(array, key) { - return array.sort(function(a, b) { + return array.sort(function (a, b) { const x = a[key]; const y = b[key]; return ((x < y) ? 1 : ((x > y) ? -1 : 0)); @@ -55,7 +57,8 @@ module.exports = { shuffle(pArray) { const array = []; pArray.forEach(element => array.push(element)); - let currentIndex = array.length, temporaryValue, randomIndex; + let currentIndex = array.length, + temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { @@ -82,26 +85,34 @@ module.exports = { const absoluteHours = Math.floor((time / (1000 * 60 * 60)) % 24); const absoluteDays = Math.floor(time / (1000 * 60 * 60 * 24)); - const d = absoluteDays - ? absoluteDays === 1 - ? guild.translate("time:ONE_DAY") - : guild.translate("time:DAYS", { amount: absoluteDays }) - : null; - const h = absoluteHours - ? absoluteHours === 1 - ? guild.translate("time:ONE_HOUR") - : guild.translate("time:HOURS", { amount: absoluteHours }) - : null; - const m = absoluteMinutes - ? absoluteMinutes === 1 - ? guild.translate("time:ONE_MINUTE") - : guild.translate("time:MINUTES", { amount: absoluteMinutes }) - : null; - const s = absoluteSeconds - ? absoluteSeconds === 1 - ? guild.translate("time:ONE_SECOND") - : guild.translate("time:SECONDS", { amount: absoluteSeconds }) - : null; + const d = absoluteDays ? + absoluteDays === 1 ? + guild.translate("time:ONE_DAY") : + guild.translate("time:DAYS", { + amount: absoluteDays + }) : + null; + const h = absoluteHours ? + absoluteHours === 1 ? + guild.translate("time:ONE_HOUR") : + guild.translate("time:HOURS", { + amount: absoluteHours + }) : + null; + const m = absoluteMinutes ? + absoluteMinutes === 1 ? + guild.translate("time:ONE_MINUTE") : + guild.translate("time:MINUTES", { + amount: absoluteMinutes + }) : + null; + const s = absoluteSeconds ? + absoluteSeconds === 1 ? + guild.translate("time:ONE_SECOND") : + guild.translate("time:SECONDS", { + amount: absoluteSeconds + }) : + null; const absoluteTime = []; if (d) absoluteTime.push(d); diff --git a/helpers/languages.js b/helpers/languages.js index ba09bacd..20d63044 100644 --- a/helpers/languages.js +++ b/helpers/languages.js @@ -21,7 +21,10 @@ async function walkDirectory(dir, namespaces = [], folderName = "") { }; }; - return { namespaces: [...new Set(namespaces)], languages }; + return { + namespaces: [...new Set(namespaces)], + languages + }; }; module.exports = async () => { diff --git a/helpers/logger.js b/helpers/logger.js index 75d52b66..89e8a230 100644 --- a/helpers/logger.js +++ b/helpers/logger.js @@ -12,16 +12,16 @@ function dateTimePad(value, digits) { function format(tDate) { return (tDate.getFullYear() + "-" + - dateTimePad((tDate.getMonth() + 1), 2) + "-" + - dateTimePad(tDate.getDate(), 2) + " " + - dateTimePad(tDate.getHours(), 2) + ":" + - dateTimePad(tDate.getMinutes(), 2) + ":" + - dateTimePad(tDate.getSeconds(), 2) + "." + - dateTimePad(tDate.getMilliseconds(), 3)); + dateTimePad((tDate.getMonth() + 1), 2) + "-" + + dateTimePad(tDate.getDate(), 2) + " " + + dateTimePad(tDate.getHours(), 2) + ":" + + dateTimePad(tDate.getMinutes(), 2) + ":" + + dateTimePad(tDate.getSeconds(), 2) + "." + + dateTimePad(tDate.getMilliseconds(), 3)); }; module.exports = class Logger { - static log (content, type = "log") { + static log(content, type = "log") { const date = `[${format(new Date(Date.now()))}]:`; switch (type) { // Check the message type and then print him in the console @@ -29,27 +29,28 @@ module.exports = class Logger { return console.log(`${date} ${bgBlue(type.toUpperCase())} ${content} `); }; - case "warn": { - return console.log(`${date} ${black.bgYellow(type.toUpperCase())} ${content} `); - }; + case "warn": { + return console.log(`${date} ${black.bgYellow(type.toUpperCase())} ${content} `); + }; - case "error": { - return console.log(`${date} ${black.bgRed(type.toUpperCase())} ${content} `); - }; + case "error": { + return console.log(`${date} ${black.bgRed(type.toUpperCase())} ${content} `); + }; - case "debug": { - return console.log(`${date} ${green(type.toUpperCase())} ${content} `); - }; + case "debug": { + return console.log(`${date} ${green(type.toUpperCase())} ${content} `); + }; - case "cmd": { - return console.log(`${date} ${black.bgWhite(type.toUpperCase())} ${content}`); - }; + case "cmd": { + return console.log(`${date} ${black.bgWhite(type.toUpperCase())} ${content}`); + }; - case "ready": { - return console.log(`${date} ${black.bgGreen(type.toUpperCase())} ${content}`); - }; + case "ready": { + return console.log(`${date} ${black.bgGreen(type.toUpperCase())} ${content}`); + }; - default: throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error."); + default: + throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error."); }; } }; \ No newline at end of file diff --git a/helpers/resolvers.js b/helpers/resolvers.js index 77373a5f..e247db34 100644 --- a/helpers/resolvers.js +++ b/helpers/resolvers.js @@ -42,7 +42,9 @@ const resolveMember = async ({ message, search, useMessageContent = true }) => { }; // Try with name with @ - await message.guild.members.fetch({ query: search }); + await message.guild.members.fetch({ + query: search + }); if (message.guild.members.cache.some(member => member.user.tag === search || member.user.username === search)) { const memberFound = message.guild.members.cache.find(member => member.user.tag === search || member.user.username === search); diff --git a/index.js b/index.js index e57338ef..918395ec 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,9 @@ const Sentry = require("@sentry/node"), const config = require("./config"); if (config.apiKeys.sentryDSN) { try { - Sentry.init({ dsn: config.apiKeys.sentryDSN }); + Sentry.init({ + dsn: config.apiKeys.sentryDSN + }); } catch (e) { console.log(e); console.log(chalk.yellow("Looks like your Sentry DSN key is invalid. If you do not intend to use Sentry, please remove the key from the configuration file.")); @@ -41,7 +43,7 @@ const init = async () => { evtFiles.forEach((file) => { const eventName = file.split(".")[0]; client.logger.log(`Loading Event: ${eventName}`); - const event = new (require(`./events/${file}`))(client); + const event = new(require(`./events/${file}`))(client); client.on(eventName, (...args) => event.run(...args)); delete require.cache[require.resolve(`./events/${file}`)]; }); @@ -49,7 +51,10 @@ const init = async () => { client.login(client.config.token); // Log in to the discord api // connect to mongoose database - mongoose.connect(client.config.mongoDB, { useNewUrlParser: true, useUnifiedTopology: true }).then(() => { + mongoose.connect(client.config.mongoDB, { + useNewUrlParser: true, + useUnifiedTopology: true + }).then(() => { client.logger.log("Connected to the Mongodb database.", "log"); }).catch((err) => { client.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error"); diff --git a/languages/en-US/fun/lovecalc.json b/languages/en-US/fun/lovecalc.json index d2dbf60b..4491712f 100644 --- a/languages/en-US/fun/lovecalc.json +++ b/languages/en-US/fun/lovecalc.json @@ -1,5 +1,5 @@ { - "DESCRIPTION": "How much love is there between two people?\n*This is a fun command, not to be taken seriously*", + "DESCRIPTION": "Love calculator", "USAGE": "{{prefix}}lovecalc [@member1] (@member2)", "EXAMPLES": "{{prefix}}lovecalc @Jonny_Bro#4226\n{{prefix}}lovecalc @Jonny_Bro#4226 @JaBa#9042", "MISSING": "You must mention two members!", diff --git a/languages/en-US/images/avatar.json b/languages/en-US/images/avatar.json index a3398c7c..29679ef0 100644 --- a/languages/en-US/images/avatar.json +++ b/languages/en-US/images/avatar.json @@ -1,5 +1,5 @@ { "DESCRIPTION": "Shows the avatar of the mentionned member", "USAGE": "{{prefix}}avatar (@member)", - "EXAMPLES": "{{prefix}}avatar\n{{prefix}}avatar @Jonny_Bro#4226" + "EXAMPLES": "{{prefix}}avatar\n{{prefix}}avatar @Jonny_Bro#4226\n{{prefix}}avatar link" } \ No newline at end of file diff --git a/languages/ru-RU/fun/lovecalc.json b/languages/ru-RU/fun/lovecalc.json index 22f8be5f..3824d0f8 100644 --- a/languages/ru-RU/fun/lovecalc.json +++ b/languages/ru-RU/fun/lovecalc.json @@ -1,5 +1,5 @@ { - "DESCRIPTION": "Как сильно они любят друг друга?", + "DESCRIPTION": "Калькулятор любви", "USAGE": "{{prefix}}lovecalc [@пользователь1] (@пользователь2)", "EXAMPLES": "{{prefix}}lovecalc @Jonny_Bro#4226\n{{prefix}}lovecalc @Jonny_Bro#4226 @JaBa#9042", "MISSING": "Вы должны упомянуть одного или двух пользователей!", diff --git a/languages/ru-RU/images/avatar.json b/languages/ru-RU/images/avatar.json index e2b2c1f3..fa53acb3 100644 --- a/languages/ru-RU/images/avatar.json +++ b/languages/ru-RU/images/avatar.json @@ -1,5 +1,5 @@ { "DESCRIPTION": "Возвращает аватар пользователя", - "USAGE": "{{prefix}}avatar (@пользователь) (-v)", - "EXAMPLES": "{{prefix}}avatar\n{{prefix}}avatar @Jonny_Bro#4226\n{{prefix}}avatar -v" + "USAGE": "{{prefix}}avatar (@пользователь) (link)", + "EXAMPLES": "{{prefix}}avatar\n{{prefix}}avatar @Jonny_Bro#4226\n{{prefix}}avatar link" } \ No newline at end of file diff --git a/scripts/create-db-indexes.js b/scripts/create-db-indexes.js index 96ef65a7..a6333eab 100644 --- a/scripts/create-db-indexes.js +++ b/scripts/create-db-indexes.js @@ -26,15 +26,22 @@ client.connect().then(async () => { const users = db.collection("users"); console.log(chalk.yellow("Creating guilds index...")); - await guilds.createIndex({ id: 1 }); + await guilds.createIndex({ + id: 1 + }); console.log(chalk.green("Guilds index created.")); console.log(chalk.yellow("Creating members index...")); - await members.createIndex({ guildID: 1, id: -1 }); + await members.createIndex({ + guildID: 1, + id: -1 + }); console.log(chalk.green("Members index created.")); console.log(chalk.yellow("Creating users index...")); - await users.createIndex({ id: 1 }); + await users.createIndex({ + id: 1 + }); console.log(chalk.green("Users index created.")); console.log(chalk.blue("\n\nIndexes created.")); diff --git a/scripts/migrate-db-from-v4.6-to-v4.7.js b/scripts/migrate-db-from-v4.6-to-v4.7.js index 98e5a0f1..90517407 100644 --- a/scripts/migrate-db-from-v4.6-to-v4.7.js +++ b/scripts/migrate-db-from-v4.6-to-v4.7.js @@ -23,11 +23,11 @@ client.connect().then(async () => { const db = client.db(dbName); const guilds = db.collection("guilds"); - const count = await guilds.countDocuments({ $or: [ { language: "english" }, { language: "russian" } ] }); + const count = await guilds.countDocuments({ $or: [{ language: "english" }, { language: "russian" }] }); console.log(chalk.yellow(`${count} guilds need to be migrated. Migrating...`)); - await guilds.updateMany({ language: "english" }, { $set: { language: "en-US"} }); - await guilds.updateMany({ language: "russian" }, { $set: { language: "ru-RU"} }); + await guilds.updateMany({ language: "english" }, { $set: { language: "en-US" } }); + await guilds.updateMany({ language: "russian" }, { $set: { language: "ru-RU" } }); console.log(chalk.green(`${count} guilds migrated.`)); console.log(chalk.blue("\n\nDatabase migrated from v4.6.4 to v4.7.0...")); diff --git a/scripts/verify-config.js b/scripts/verify-config.js index 8d62f321..e64f7a30 100644 --- a/scripts/verify-config.js +++ b/scripts/verify-config.js @@ -132,7 +132,9 @@ const checks = [ } else { const Sentry = require("@sentry/node"); try { - Sentry.init({ dsn: config.apiKeys.sentryDSN }); + Sentry.init({ + dsn: config.apiKeys.sentryDSN + }); await delay(1000); success("should be a valid Sentry DSN key"); } catch (e) { @@ -155,9 +157,9 @@ const checks = [ .once("error", () => { resolve(true); }) - .once("listening", function() { + .once("listening", function () { tester - .once("close", function() { + .once("close", function () { resolve(false); }) .close();