diff --git a/commands/Administration/backup.js b/commands/Administration/backup.js index 00ce84a7..47c7fcc4 100644 --- a/commands/Administration/backup.js +++ b/commands/Administration/backup.js @@ -36,7 +36,7 @@ class Backup extends Command { Sentry.captureException(err); return message.error("misc:ERR_OCCURRED"); }); - } else if (status === "load"){ + } else if (status === "load") { const backupID = args[1]; if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID"); @@ -68,7 +68,7 @@ class Backup extends Command { backupID }); }); - } else if (status === "info"){ + } else if (status === "info") { const backupID = args[1]; if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID"); diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js index beb426f9..317e0b32 100644 --- a/commands/Economy/slots.js +++ b/commands/Economy/slots.js @@ -38,7 +38,7 @@ class Slots extends Command { amount = Math.round(amount); - function getCredits(number, isJackpot){ + function getCredits(number, isJackpot) { if (!isJackpot) { number = number * 1.5; } else if (isJackpot) { diff --git a/commands/Fun/findwords.js b/commands/Fun/findwords.js index c015c2d8..d20e0298 100644 --- a/commands/Fun/findwords.js +++ b/commands/Fun/findwords.js @@ -46,7 +46,7 @@ class FindWords extends Command { currentGames[message.guild.id] = true; // Update current game variable generateGame.call(this, words[i]); // Generate a new round - function generateGame(word){ + function generateGame(word) { word = word.toLowerCase(); // Launch timer @@ -107,8 +107,8 @@ class FindWords extends Command { }, delay); }; - async function getWinner(array){ - return new Promise(function (resolve){ + async function getWinner(array) { + return new Promise(function (resolve) { const counts = {}; let compare = 0; let mostFrequent; @@ -119,7 +119,7 @@ class FindWords extends Command { } else { counts[winner] = counts[winner] + 1; }; - if (counts[winner] > compare){ + if (counts[winner] > compare) { compare = counts[winner]; mostFrequent = array[i]; }; diff --git a/commands/General/hastebin.js b/commands/General/hastebin.js index 359d07a3..da9b9023 100644 --- a/commands/General/hastebin.js +++ b/commands/General/hastebin.js @@ -39,7 +39,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/quote.js b/commands/General/quote.js index 4487003b..56ce9131 100644 --- a/commands/General/quote.js +++ b/commands/General/quote.js @@ -18,7 +18,7 @@ class Quote extends Command { } async run (message, args, data) { - function embed(m){ + function embed(m) { const embed = new Discord.MessageEmbed() .setAuthor(m.author.tag, m.author.displayAvatarURL({ size: 512, dynamic: true, format: 'png' })) .setDescription(m.content) diff --git a/commands/Images/bed.js b/commands/Images/bed.js index ddf45841..e05adad4 100644 --- a/commands/Images/bed.js +++ b/commands/Images/bed.js @@ -30,7 +30,7 @@ class Bed extends Command { 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 }); }; diff --git a/commands/Images/captcha.js b/commands/Images/captcha.js index 8e622da7..86695a77 100644 --- a/commands/Images/captcha.js +++ b/commands/Images/captcha.js @@ -27,7 +27,7 @@ class Captcha extends Command { 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/clyde.js b/commands/Images/clyde.js index e4722ef0..e1442a39 100644 --- a/commands/Images/clyde.js +++ b/commands/Images/clyde.js @@ -30,7 +30,7 @@ class Clyde extends Command { 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 }); }; diff --git a/commands/Images/love.js b/commands/Images/love.js index 3dee7015..ae83884d 100644 --- a/commands/Images/love.js +++ b/commands/Images/love.js @@ -31,7 +31,7 @@ class Love extends Command { 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 }); }; diff --git a/commands/Images/phcomment.js b/commands/Images/phcomment.js index 2a5d7f6b..2835b67f 100644 --- a/commands/Images/phcomment.js +++ b/commands/Images/phcomment.js @@ -42,7 +42,7 @@ class Phcomment extends Command { 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 }); }; diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index 5f44ece2..ab03e633 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -58,7 +58,7 @@ class Clear extends Command { toDelete = await message.success("moderation/clear:CLEARED", { amount: --amount }); }; - setTimeout(function(){ + setTimeout(function() { toDelete.delete(); }, 2000); } diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js index 6f304814..a4b53a13 100644 --- a/commands/Moderation/giveaway.js +++ b/commands/Moderation/giveaway.js @@ -60,7 +60,7 @@ class Giveaway extends Command { }).then(() => { message.success("moderation/giveaway:GIVEAWAY_CREATED"); }); - } else if(status === "reroll"){ + } else if (status === "reroll") { const messageID = args[1]; if (!messageID)return message.error("moderation/giveaway:MISSING_ID"); @@ -72,23 +72,23 @@ class Giveaway extends Command { }).catch(() => { return message.error("moderation/giveaway:NOT_FOUND_ENDED", { messageID }); }); - } else if(status === "delete"){ + } else if (status === "delete") { 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.delete(messageID).then(() => { return message.success("moderation/giveaway:GIVEAWAY_DELETED"); }).catch(() => { return message.error("moderation/giveaway:NOT_FOUND", { messageID }); }); - } else if(status === "end"){ + } 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() }); return message.success("moderation/giveaway:GIVEAWAY_ENDED"); - } catch(e){ + } catch(e) { return message.error("moderation/giveaway:NOT_FOUND", { messageID }); }; } else { diff --git a/commands/Moderation/setwarns.js b/commands/Moderation/setwarns.js index 0ea5c18c..74a50464 100644 --- a/commands/Moderation/setwarns.js +++ b/commands/Moderation/setwarns.js @@ -28,7 +28,7 @@ class Setwarns extends Command { data.guild.markModified("plugins.warnsSanctions"); data.guild.save(); return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { prefix: data.guild.prefix, count: number }); - } else if(sanction === "ban") { + } else if (sanction === "ban") { data.guild.plugins.warnsSanctions.ban = false; data.guild.markModified("plugins.warnsSanctions"); data.guild.save(); diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js index 24684af8..89122e1a 100644 --- a/commands/Moderation/unban.js +++ b/commands/Moderation/unban.js @@ -30,7 +30,7 @@ class Unban extends Command { // if a user was found user = u; }).catch(() => {}); - } else if(!isId) { + } else if (!isId) { const arr = args[0].split("#"); if (arr.length < 2) { return message.error("misc:NO_USER_FOUND_ID", { diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 7a5f2648..9ae894f4 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -88,7 +88,7 @@ class Warn extends Command { if (data.guild.plugins.modlogs) { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); - if(!channel) return; + if (!channel) return; channel.send(embed); }; } diff --git a/commands/Music/lyrics.js b/commands/Music/lyrics.js index f2f1d552..1d747998 100644 --- a/commands/Music/lyrics.js +++ b/commands/Music/lyrics.js @@ -44,7 +44,7 @@ class Lyrics extends Command { embed.setDescription(lyrics); message.channel.send(embed); - } catch(e){ + } catch(e) { console.log(e); message.error("music/lyrics:NO_LYRICS_FOUND", { songName }); } diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 820a8c0c..8daef4e0 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -5,7 +5,6 @@ const Canvas = require("canvas"), // Register assets fonts Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "Regular" }); -// Canvas.registerFont(resolve("./assets/fonts/RussoOne-Regular.ttf"), { family: "Regular" }); const applyText = (canvas, text, defaultFontSize) => { const ctx = canvas.getContext("2d"); diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index cdbf9f2c..e5f8ff6d 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -5,7 +5,6 @@ const Canvas = require("canvas"), // Register assets fonts Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "Regular" }); -// Canvas.registerFont(resolve("./assets/fonts/RussoOne-Regular.ttf"), { family: "Regular" }); const applyText = (canvas, text, defaultFontSize) => { const ctx = canvas.getContext("2d"); diff --git a/events/guildMemberUpdate.js b/events/guildMemberUpdate.js index e1396df2..eb031d13 100644 --- a/events/guildMemberUpdate.js +++ b/events/guildMemberUpdate.js @@ -5,8 +5,8 @@ module.exports = class { async run (oldMember, newMember) { if (oldMember.guild.id !== this.client.config.support.id) return; - if (oldMember.roles.cache.some((r) => r.name === "Поддержавшие")) return; - if (newMember.roles.cache.some((r) => r.name === "Поддержавшие")) { + 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 }); userData.achievements.tip.progress.now = 1; userData.achievements.tip.achieved = true; diff --git a/events/message.js b/events/message.js index 9fee123d..c77b8346 100644 --- a/events/message.js +++ b/events/message.js @@ -27,14 +27,9 @@ module.exports = class { // Check if the bot was mentionned if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) { if (message.guild) { - return message.sendT("misc:HELLO_SERVER", { - username: message.author.username, - prefix: data.guild.prefix - }); + return message.sendT("misc:HELLO_SERVER", { username: message.author.username, prefix: data.guild.prefix }); } else { - return message.sendT("misc:HELLO_DM", { - username: message.author.username - }); + return message.sendT("misc:HELLO_DM", { username: message.author.username }); }; }; @@ -60,10 +55,7 @@ module.exports = class { if (uSlowmode.time > Date.now()) { 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(); }; @@ -83,9 +75,7 @@ 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 }); }; }; }; @@ -94,18 +84,13 @@ 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 - }); + message.error("general/setafk:IS_AFK", { user: u.tag, reason: userData.afk }); }; }); }; @@ -122,17 +107,11 @@ module.exports = class { const customCommandAnswer = customCommand ? customCommand.answer : ""; if (!cmd && !customCommandAnswer && message.guild) return; - else if (!cmd && !customCommandAnswer && !message.guild) { - return message.sendT("misc:HELLO_DM", { - username: message.author.username - }); - }; + else if (!cmd && !customCommandAnswer && !message.guild) return message.sendT("misc:HELLO_DM", { username: message.author.username }); 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() - })); + message.author.send(message.translate("misc:RESTRICTED_CHANNEL", { channel: message.channel.toString() })); return; }; @@ -142,30 +121,21 @@ module.exports = class { if (message.guild) { let neededPermissions = []; - if (!cmd.conf.botPermissions.includes("EMBED_LINKS")) { - cmd.conf.botPermissions.push("EMBED_LINKS"); - }; + if (!cmd.conf.botPermissions.includes("EMBED_LINKS")) cmd.conf.botPermissions.push("EMBED_LINKS"); cmd.conf.botPermissions.forEach((perm) => { if (!message.channel.permissionsFor(message.guild.me).has(perm)) { neededPermissions.push(perm); }; }); - 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) => { if (!message.channel.permissionsFor(message.member).has(perm)) { neededPermissions.push(perm); }; }); - if (neededPermissions.length > 0) { - return message.error("misc:MISSING_MEMBER_PERMS", { - list: neededPermissions.map((p) => `\`${p}\``).join(", ") - }); - }; + if (neededPermissions.length > 0) return message.error("misc:MISSING_MEMBER_PERMS", { list: neededPermissions.map((p) => `\`${p}\``).join(", ") }); if (!message.channel.permissionsFor(message.member).has("MENTION_EVERYONE") && (message.content.includes("@everyone") || message.content.includes("@here"))) return message.error("misc:EVERYONE_MENTION"); if (!message.channel.nsfw && cmd.conf.nsfw) return message.error("misc:NSFW_COMMAND"); }; @@ -180,11 +150,7 @@ module.exports = class { uCooldown = cmdCooldown[message.author.id]; }; 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} on ${message.guild.name}`, "cmd"); diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index a95ec8ed..4e5fe33f 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -13,7 +13,7 @@ module.exports = { client.databaseCache.usersReminds.set(user.id, user); }; }); - setInterval(async function(){ + 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 ec4591f9..d8263ef9 100644 --- a/helpers/checkUnmutes.js +++ b/helpers/checkUnmutes.js @@ -6,7 +6,7 @@ module.exports = { * Starts checking... * @param {object} client The Discord Client instance */ - async init(client){ + async init(client) { client.membersData.find({ "mute.muted": true }).then((members) => { members.forEach((member) => { client.databaseCache.mutedUsers.set(`${member.id}${member.guildID}`, member); diff --git a/helpers/discordbots.org.js b/helpers/discordbots.org.js index c3d2340a..56ccfcd8 100644 --- a/helpers/discordbots.org.js +++ b/helpers/discordbots.org.js @@ -6,10 +6,10 @@ module.exports = { * Starts to post stats to DBL * @param {object} client The Discord Client instance */ - init(client){ + 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 }); diff --git a/helpers/logger.js b/helpers/logger.js index 4f6dab3a..9a8784e3 100644 --- a/helpers/logger.js +++ b/helpers/logger.js @@ -3,7 +3,7 @@ Logger class for easy and aesthetically pleasing console logging */ const { bgBlue, black, green } = require("chalk"); -function dateTimePad(value, digits){ +function dateTimePad(value, digits) { let number = value; while (number.toString().length < digits) { number = "0" + number; @@ -11,7 +11,7 @@ function dateTimePad(value, digits){ return number; }; -function format(tDate){ +function format(tDate) { return (tDate.getFullYear() + "-" + dateTimePad((tDate.getMonth() + 1), 2) + "-" + dateTimePad(tDate.getDate(), 2) + " " + diff --git a/scripts/verify-config.js b/scripts/verify-config.js index fd61ac74..a4096970 100644 --- a/scripts/verify-config.js +++ b/scripts/verify-config.js @@ -121,7 +121,7 @@ const checks = [ } }); const result = await res.json(); - if(result.status && result.status === 401){ + if (result.status && result.status === 401) { error("should be a valid FNBR key", "get your key here: https://fnbr.co/api/docs"); } else { success("should be a valid FNBR key"); @@ -179,7 +179,7 @@ const checks = [ (async () => { console.log(chalk.yellow("This script will check if your config is errored, and some other important things such as whether your database is started, etc...")); - for (const check of checks){ + for (const check of checks) { await check(); }; console.log(chalk.yellow("\n\nThank you for using Atlanta. If you need more help, join our support server here: https://discord.atlanta-bot.fr"));