diff --git a/base/Guild.js b/base/Guild.js index b2a41584..fb23c2ad 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -14,31 +14,31 @@ module.exports = mongoose.model("Guild", new Schema({ enabled: false, message: null, channel: null, - withImage: null + withImage: null, }, goodbye: { enabled: false, message: null, channel: null, - withImage: null + withImage: null, }, autorole: { enabled: false, - role: null + role: null, }, automod: { enabled: false, - ignored: [] + ignored: [], }, warnsSanctions: { kick: false, - ban: false + ban: false, }, news: false, suggestions: false, modlogs: false, birthdays: false, - reports: false - }}, + reports: false, + } }, casesCount: { type: Number, default: 0 }, })); \ No newline at end of file diff --git a/base/JaBa.js b/base/JaBa.js index 8be67bcd..2ba018bb 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -50,21 +50,20 @@ class JaBa extends Client { playdl.getFreeClientID().then(id => playdl.setToken({ soundcloud: { - client_id: id - } + client_id: id, + }, })); this.player.on("trackStart", async (queue, track) => { const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) }); - if (track.durationMS > 1) { + if (track.durationMS > 1) setTimeout(() => { if (m.deletable) m.delete(); }, track.durationMS); - } else { + else setTimeout(() => { if (m.deletable) m.delete(); }, (10 * 60 * 1000)); // m * s * ms - } }); this.player.on("queueEnd", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language))); this.player.on("channelEmpty", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language))); @@ -83,8 +82,8 @@ class JaBa extends Client { botsCanWin: false, embedColor: this.config.embed.color, embedColorEnd: "#FF0000", - reaction: "🎉" - } + reaction: "🎉", + }, }); } @@ -96,7 +95,7 @@ class JaBa extends Client { mongoose.connect(this.config.mongoDB, { useNewUrlParser: true, - useUnifiedTopology: true + useUnifiedTopology: true, }).then(() => { this.logger.log("Connected to the Mongodb database.", "log"); }).catch((err) => { @@ -114,7 +113,11 @@ class JaBa extends Client { */ async loadCommands(dir) { const filePath = path.join(__dirname, dir); - var folders = await fs.readdir(filePath); folders = folders.map(file => path.join(filePath, file)).filter(async (path) => { path = await fs.lstat(path); path.isDirectory(); }); + let folders = await fs.readdir(filePath); + folders = folders + .map(file => path.join(filePath, file)) + .filter(async path => { path = await fs.lstat(path); path.isDirectory(); }); + const rest = new REST().setToken(this.config.token); const commands = []; for (let index = 0; index < folders.length; index++) { @@ -130,14 +133,13 @@ class JaBa extends Client { const command = new Command(this); this.commands.set(command.command.name, command); const aliases = []; - if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) { + if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) command.aliases.forEach((alias) => { const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command }; command_alias.name = alias; aliases.push(command_alias); this.commands.set(alias, command); }); - } commands.push((command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? command.command.toJSON() : command.command, ...aliases); @@ -149,19 +151,18 @@ class JaBa extends Client { } try { - if (this.config.production) { + if (this.config.production) await rest.put( Routes.applicationCommands(this.config.user), { - body: commands - } + body: commands, + }, ); - } else { + else await rest.put( Routes.applicationGuildCommands(this.config.user, this.config.support.id), { - body: commands - } + body: commands, + }, ); - } this.logger.log("Successfully registered application commands."); } catch (err) { @@ -180,14 +181,13 @@ class JaBa extends Client { const command = new Command(this); this.commands.set(command.command.name, command); const aliases = []; - if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) { + if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) command.aliases.forEach((alias) => { const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command }; command_alias.name = alias; aliases.push(command_alias); this.commands.set(alias, command); }); - } if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this); this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`); @@ -312,9 +312,9 @@ class JaBa extends Client { 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 + id: userID, }).lean() : await this.usersData.findOne({ - id: userID + id: userID, })); if (userData) { if (!isLean) this.databaseCache.users.set(userID, userData); @@ -322,7 +322,7 @@ class JaBa extends Client { return userData; } else { userData = new this.usersData({ - id: userID + id: userID, }); await userData.save(); this.databaseCache.users.set(userID, userData); @@ -343,10 +343,10 @@ class JaBa extends Client { else { let memberData = (isLean ? await this.membersData.findOne({ guildID: guildId, - id: memberID + id: memberID, }).lean() : await this.membersData.findOne({ guildID: guildId, - id: memberID + id: memberID, })); if (memberData) { if (!isLean) this.databaseCache.members.set(`${memberID}${guildId}`, memberData); @@ -355,11 +355,11 @@ class JaBa extends Client { } else { memberData = new this.membersData({ id: memberID, - guildID: guildId + guildID: guildId, }); await memberData.save(); const guild = await this.findOrCreateGuild({ - id: guildId + id: guildId, }); if (guild) { guild.members.push(memberData._id); @@ -382,9 +382,9 @@ class JaBa extends Client { 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 + id: guildId, }).populate("members").lean() : await this.guildsData.findOne({ - id: guildId + id: guildId, }).populate("members")); if (guildData) { if (!isLean) this.databaseCache.guilds.set(guildId, guildData); @@ -392,7 +392,7 @@ class JaBa extends Client { return guildData; } else { guildData = new this.guildsData({ - id: guildId + id: guildId, }); await guildData.save(); this.databaseCache.guilds.set(guildId, guildData); diff --git a/base/Member.js b/base/Member.js index 9a010c58..b0ea25d3 100644 --- a/base/Member.js +++ b/base/Member.js @@ -15,13 +15,13 @@ module.exports = mongoose.model("Member", new mongoose.Schema({ cooldowns: { type: Object, default: { work: 0, - rob: 0 - }}, + rob: 0, + } }, sanctions: { type: Array, default: [] }, mute: { type: Object, default: { muted: false, case: null, - endDate: null - }}, + endDate: null, + } }, })); \ No newline at end of file diff --git a/base/User.js b/base/User.js index c6ffd02c..05489c50 100644 --- a/base/User.js +++ b/base/User.js @@ -4,9 +4,9 @@ const mongoose = require("mongoose"), const genToken = () => { let token = ""; const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwzy0123456789.-_"; - for (let i = 0; i < 32; i++) { + for (let i = 0; i < 32; i++) token += characters.charAt(Math.floor(Math.random() * characters.length)); - } + return token; }; @@ -25,61 +25,61 @@ const userSchema = new mongoose.Schema({ achieved: false, progress: { now: 0, - total: 1 - } + total: 1, + }, }, work: { achieved: false, progress: { now: 0, - total: 10 - } + total: 10, + }, }, firstCommand: { achieved: false, progress: { now: 0, - total: 1 - } + total: 1, + }, }, slots: { achieved: false, progress: { now: 0, - total: 3 - } + total: 3, + }, }, tip: { achieved: false, progress: { now: 0, - total: 1 - } + total: 1, + }, }, rep: { achieved: false, progress: { now: 0, - total: 20 + total: 20, }, }, invite: { achieved: false, progress: { now: 0, - total: 1 - } - } - }}, + total: 1, + }, + }, + } }, cooldowns: { type: Object, default: { - rep: 0 - }}, + rep: 0, + } }, afk: { type: String, default: null }, reminds: { type: Array, default: [] }, logged: { type: Boolean, default: false }, - apiToken: { type: String, default: genToken() } + apiToken: { type: String, default: genToken() }, }); userSchema.method("getAchievements", async function() { @@ -93,7 +93,7 @@ userSchema.method("getAchievements", async function() { await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`), await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`), await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`) + await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`), ]; let dim = 0; diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js index 7718098b..222d8efd 100644 --- a/commands/Administration/automod.js +++ b/commands/Administration/automod.js @@ -21,7 +21,7 @@ class Automod extends BaseCommand { .addChannelTypes(ChannelType.GuildText)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -44,7 +44,7 @@ class Automod extends BaseCommand { if (state) { data.guildData.plugins.automod = { enabled: true, - ignored: [] + ignored: [], }; data.guildData.markModified("plugins.automod"); await data.guildData.save(); @@ -55,12 +55,12 @@ class Automod extends BaseCommand { data.guildData.markModified("plugins.automod"); await data.guildData.save(); interaction.success("administration/automod:DISABLED_CHANNEL", { - channel: channel.toString() + channel: channel.toString(), }); } else { data.guildData.plugins.automod = { enabled: false, - ignored: [] + ignored: [], }; data.guildData.markModified("plugins.automod"); await data.guildData.save(); diff --git a/commands/Administration/autorole.js b/commands/Administration/autorole.js index 0729b541..ee7749b2 100644 --- a/commands/Administration/autorole.js +++ b/commands/Administration/autorole.js @@ -20,7 +20,7 @@ class Autorole extends BaseCommand { .setDescription(client.translate("common:ROLE"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -45,18 +45,18 @@ class Autorole extends BaseCommand { data.guildData.plugins.autorole = { enabled: true, - role: role.id + role: role.id, }; data.guildData.markModified("plugins.autorole"); await data.guildData.save(); interaction.success("administration/autorole:SUCCESS_ENABLED", { - role: role.toString() + role: role.toString(), }); } else { data.guildData.plugins.autorole = { enabled: false, - role: null + role: null, }; data.guildData.markModified("plugins.autorole"); await data.guildData.save(); diff --git a/commands/Administration/config.js b/commands/Administration/config.js index f6f0103d..76304520 100644 --- a/commands/Administration/config.js +++ b/commands/Administration/config.js @@ -14,7 +14,7 @@ class Config extends BaseCommand { .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .addSubcommand(subcommand => subcommand.setName("list") - .setDescription(client.translate("administration/config:LIST")) + .setDescription(client.translate("administration/config:LIST")), ) .addSubcommand(subcommand => subcommand.setName("set") .setDescription(client.translate("administration/config:SET")) @@ -25,18 +25,18 @@ class Config extends BaseCommand { { name: client.translate("administration/config:MODLOGS"), value: "modlogs" }, { name: client.translate("administration/config:NEWS"), value: "news" }, { name: client.translate("administration/config:REPORTS"), value: "reports" }, - { name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" } + { name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" }, ) .setRequired(true)) .addBooleanOption(option => option.setName("state") .setDescription(client.translate("common:STATE")) .setRequired(true)) .addChannelOption(option => option.setName("channel") - .setDescription(client.translate("common:CHANNEL"))) + .setDescription(client.translate("common:CHANNEL"))), ), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -61,65 +61,65 @@ class Config extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.guild.name, - iconURL: interaction.guild.iconURL() + iconURL: interaction.guild.iconURL(), }) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .addFields([ { name: interaction.translate("administration/config:WELCOME_TITLE"), value: guildData.plugins.welcome.enabled ? interaction.translate("administration/config:WELCOME_CONTENT", { channel: `<#${guildData.plugins.welcome.channel}>`, - withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO") + withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), }) : interaction.translate("common:DISABLED"), - inline: true + inline: true, }, { name: interaction.translate("administration/config:GOODBYE_TITLE"), value: guildData.plugins.goodbye.enabled ? interaction.translate("administration/config:GOODBYE_CONTENT", { channel: `<#${guildData.plugins.goodbye.channel}>`, - withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO") + withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), }) : interaction.translate("common:DISABLED"), - inline: true + inline: true, }, { name: interaction.translate("administration/config:AUTOROLE_TITLE"), value: guildData.plugins.autorole.enabled ? `<@&${guildData.plugins.autorole.role}>` - : interaction.translate("common:DISABLED") + : interaction.translate("common:DISABLED"), }, { name: interaction.translate("administration/config:AUTO_SANCTIONS"), value: (guildData.plugins.warnsSanctions.kick ? interaction.translate("administration/config:KICK_CONTENT", { - count: guildData.plugins.warnsSanctions.kick + count: guildData.plugins.warnsSanctions.kick, }) : interaction.translate("administration/config:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? interaction.translate("administration/config:BAN_CONTENT", { - count: guildData.plugins.warnsSanctions.ban - }) : interaction.translate("administration/config:BAN_NOT_DEFINED")) + count: guildData.plugins.warnsSanctions.ban, + }) : interaction.translate("administration/config:BAN_NOT_DEFINED")), }, { name: interaction.translate("administration/config:AUTOMOD_TITLE"), value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", { - channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`) - }) : interaction.translate("common:DISABLED") + channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`), + }) : interaction.translate("common:DISABLED"), }, { name: interaction.translate("administration/config:SPECIAL_CHANNELS"), value: interaction.translate("administration/config:NEWS_LIST", { - channel: guildData.plugins.news ? `<#${guildData.plugins.news}>` : `*${interaction.translate("common:NOT_DEFINED")}*` + channel: guildData.plugins.news ? `<#${guildData.plugins.news}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, }) + "\n" + interaction.translate("administration/config:SUGGESTIONS_LIST", { - channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*` + channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, }) + "\n" + interaction.translate("administration/config:REPORTS_LIST", { - channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*` + channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, }) + "\n" + interaction.translate("administration/config:MODLOGS_LIST", { - channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*` + channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, }) + "\n" + interaction.translate("administration/config:BIRTHDAYS_LIST", { - channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*` - }) + channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*`, + }), }, // { // name: interaction.translate("administration/config:DASHBOARD_TITLE"), @@ -129,7 +129,7 @@ class Config extends BaseCommand { interaction.reply({ embeds: [embed], - ephemeral: true + ephemeral: true, }); } else { const setting = interaction.options.getString("setting"); @@ -156,7 +156,7 @@ async function changeSetting(interaction, setting, state, channel) { await interaction.guild.data.save(); return interaction.reply({ content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`, - ephemeral: true + ephemeral: true, }); } else { if (channel) { @@ -165,12 +165,13 @@ async function changeSetting(interaction, setting, state, channel) { await interaction.guild.data.save(); return interaction.reply({ content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, - ephemeral: true + ephemeral: true, + }); + } else + return interaction.reply({ + content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${interaction.guild.data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${interaction.guild.data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`}`, + ephemeral: true, }); - } else return interaction.reply({ - content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${interaction.guild.data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${interaction.guild.data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`}`, - ephemeral: true - }); } } diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js index 681b49aa..98da6a5b 100644 --- a/commands/Administration/goodbye.js +++ b/commands/Administration/goodbye.js @@ -14,7 +14,7 @@ class Goodbye extends BaseCommand { .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .addSubcommand(subcommand => subcommand.setName("test") - .setDescription(client.translate("administration/goodbye:TEST")) + .setDescription(client.translate("administration/goodbye:TEST")), ) .addSubcommand(subcommand => subcommand.setName("config") .setDescription(client.translate("administration/goodbye:CONFIG")) @@ -26,11 +26,11 @@ class Goodbye extends BaseCommand { .addStringOption(option => option.setName("message") .setDescription(client.translate("common:MESSAGE"))) .addBooleanOption(option => option.setName("image") - .setDescription(client.translate("administration/goodbye:IMAGE"))) + .setDescription(client.translate("administration/goodbye:IMAGE"))), ), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -60,7 +60,7 @@ class Goodbye extends BaseCommand { enabled: false, message: null, channelID: null, - withImage: null + withImage: null, }; data.guildData.markModified("plugins.goodbye"); await data.guildData.save(); @@ -81,7 +81,7 @@ class Goodbye extends BaseCommand { await data.guildData.save(); interaction.success("administration/goodbye:ENABLED", { - channel: `<#${data.guildData.plugins.goodbye.channel}>` + channel: `<#${data.guildData.plugins.goodbye.channel}>`, }, { ephemeral: true }); } } diff --git a/commands/Administration/selectroles.js b/commands/Administration/selectroles.js index 002883dd..073f6c8d 100644 --- a/commands/Administration/selectroles.js +++ b/commands/Administration/selectroles.js @@ -17,7 +17,7 @@ class Selectroles extends BaseCommand { .setDescription(client.translate("administration/selectroles:MESSAGE")) .addStringOption(option => option.setName("text") .setDescription(client.translate("common:MESSAGE")) - .setRequired(true)) + .setRequired(true)), ) .addSubcommand(subcommand => subcommand.setName("addrole") .setDescription(client.translate("administration/selectroles:ADDROLE")) @@ -29,11 +29,11 @@ class Selectroles extends BaseCommand { .setRequired(true)) .addRoleOption(option => option.setName("role") .setDescription(client.translate("common:ROLE")) - .setRequired(true)) + .setRequired(true)), ), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -59,7 +59,7 @@ class Selectroles extends BaseCommand { interaction.reply({ content: interaction.translate("administration/selectroles:ROLES_UPDATED", null, { ephemeral: true }), - ephemeral: true + ephemeral: true, }); } }); @@ -81,7 +81,7 @@ class Selectroles extends BaseCommand { interaction.channel.send(text).then(message => { interaction.success("administration/selectroles:MESSAGE_SENT", { channel: interaction.channel.toString(), - message_id: message.id + message_id: message.id, }, { edit: true }); }); } else if (command === "addrole") { @@ -96,7 +96,7 @@ class Selectroles extends BaseCommand { const option = [{ label: role.name, - value: role.id + value: role.id, }]; const menu = row.components[0]; @@ -110,7 +110,7 @@ class Selectroles extends BaseCommand { SelectMenuBuilder.from(menu) .setMinValues(0) .setMaxValues(menu.options.length + 1) - .addOptions(option) + .addOptions(option), ); } else { row.addComponents( @@ -119,19 +119,19 @@ class Selectroles extends BaseCommand { .setMinValues(0) .setMaxValues(1) .setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS")) - .addOptions(option) + .addOptions(option), ); } message.edit({ - components: [row] + components: [row], }); interaction.followUp({ content: interaction.translate("administration/selectroles:SUCCESS_ADDED", { - role: role.name + role: role.name, }), - ephemeral: true + ephemeral: true, }); } } diff --git a/commands/Administration/set.js b/commands/Administration/set.js index 53149ff6..aa024faf 100644 --- a/commands/Administration/set.js +++ b/commands/Administration/set.js @@ -20,7 +20,7 @@ class Set extends BaseCommand { { name: client.translate("common:LEVEL"), value: "level" }, { name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:CREDITS"), value: "credits" }, - { name: client.translate("economy/transactions:BANK"), value: "bank" } + { name: client.translate("economy/transactions:BANK"), value: "bank" }, )) .addUserOption(option => option.setName("user") .setDescription(client.translate("common:USER")) @@ -30,7 +30,7 @@ class Set extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -53,7 +53,7 @@ class Set extends BaseCommand { const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); const int = interaction.options.getInteger("int"); if (int < 0) return interaction.error("administration/set:INVALID_NUMBER", null, { ephemeral: true }); @@ -64,7 +64,7 @@ class Set extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -73,7 +73,7 @@ class Set extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -82,7 +82,7 @@ class Set extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -91,7 +91,7 @@ class Set extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } } diff --git a/commands/Administration/setlang.js b/commands/Administration/setlang.js index 4722739e..4afed238 100644 --- a/commands/Administration/setlang.js +++ b/commands/Administration/setlang.js @@ -18,11 +18,11 @@ class Setlang extends BaseCommand { .setRequired(true) .addChoices( { name: "Русский", value: "ru-RU" }, - { name: "Українська", value: "uk-UA" } + { name: "Українська", value: "uk-UA" }, )), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -46,7 +46,7 @@ class Setlang extends BaseCommand { await data.guildData.save(); return interaction.success("administration/setlang:SUCCESS", { - lang: language.nativeName + lang: language.nativeName, }); } } diff --git a/commands/Administration/stealemoji.js b/commands/Administration/stealemoji.js index 361940b0..82c33121 100644 --- a/commands/Administration/stealemoji.js +++ b/commands/Administration/stealemoji.js @@ -18,7 +18,7 @@ class Stealemoji extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -41,15 +41,15 @@ class Stealemoji extends BaseCommand { interaction.guild.emojis .create({ name: parsedEmoji.name, - attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}` + attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}`, }) .then(emoji => interaction.success("administration/stealemoji:SUCCESS", { - emoji: emoji.name + emoji: emoji.name, }, { ephemeral: true })) .catch(e => { interaction.error("administration/stealemoji:ERROR", { emoji: parsedEmoji.name, - e + e, }, { ephemeral: true }); }); } diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js index 90300707..1b1c40f0 100644 --- a/commands/Administration/welcome.js +++ b/commands/Administration/welcome.js @@ -14,7 +14,7 @@ class Welcome extends BaseCommand { .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .addSubcommand(subcommand => subcommand.setName("test") - .setDescription(client.translate("administration/goodbye:TEST")) + .setDescription(client.translate("administration/goodbye:TEST")), ) .addSubcommand(subcommand => subcommand.setName("config") .setDescription(client.translate("administration/goodbye:CONFIG")) @@ -26,11 +26,11 @@ class Welcome extends BaseCommand { .addStringOption(option => option.setName("message") .setDescription(client.translate("common:MESSAGE"))) .addBooleanOption(option => option.setName("image") - .setDescription(client.translate("administration/goodbye:IMAGE"))) + .setDescription(client.translate("administration/goodbye:IMAGE"))), ), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -60,7 +60,7 @@ class Welcome extends BaseCommand { enabled: false, message: null, channelID: null, - withImage: null + withImage: null, }; data.guildData.markModified("plugins.welcome"); await data.guildData.save(); @@ -81,7 +81,7 @@ class Welcome extends BaseCommand { await data.guildData.save(); interaction.success("administration/welcome:ENABLED", { - channel: `<#${data.guildData.plugins.welcome.channel}>` + channel: `<#${data.guildData.plugins.welcome.channel}>`, }, { ephemeral: true }); } } diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js index 5791aba0..59c45243 100644 --- a/commands/Economy/achievements.js +++ b/commands/Economy/achievements.js @@ -16,7 +16,7 @@ class Achievements extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -36,16 +36,16 @@ class Achievements extends BaseCommand { const user = interaction.options.getUser("user") || interaction.member; if (user.bot) return interaction.error("economy/profile:BOT_USER"); const userData = (user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ - id: user.id + id: user.id, })); const embed = new EmbedBuilder() .setAuthor({ - name: interaction.translate("economy/achievements:TITLE") + name: interaction.translate("economy/achievements:TITLE"), }) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); embed.addFields([ @@ -54,61 +54,61 @@ class Achievements extends BaseCommand { value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.firstCommand.progress.now, total: userData.achievements.firstCommand.progress.total, - percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)) - }) + percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)), + }), }, { name: interaction.translate("economy/achievements:CLAIM_SALARY"), value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.work.progress.now, total: userData.achievements.work.progress.total, - percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)) - }) + percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)), + }), }, { name: interaction.translate("economy/achievements:MARRY"), value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.married.progress.now, total: userData.achievements.married.progress.total, - percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)) - }) + percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)), + }), }, { name: interaction.translate("economy/achievements:SLOTS"), value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.slots.progress.now, total: userData.achievements.slots.progress.total, - percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)) - }) + percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)), + }), }, { name: interaction.translate("economy/achievements:TIP"), value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.tip.progress.now, total: userData.achievements.tip.progress.total, - percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)) - }) + percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)), + }), }, { name: interaction.translate("economy/achievements:REP"), value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.rep.progress.now, total: userData.achievements.rep.progress.total, - percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)) - }) + percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)), + }), }, { name: interaction.translate("economy/achievements:INVITE"), value: interaction.translate("economy/achievements:PROGRESS", { now: userData.achievements.invite.progress.now, total: userData.achievements.invite.progress.total, - percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)) - }) - } + percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)), + }), + }, ]); interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Economy/bank.js b/commands/Economy/bank.js index c9900881..d07daff1 100644 --- a/commands/Economy/bank.js +++ b/commands/Economy/bank.js @@ -17,14 +17,14 @@ class Bank extends BaseCommand { .setRequired(true) .addChoices( { name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, - { name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" } + { name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }, )) .addStringOption(option => option.setName("credits") .setDescription(client.translate("moderation/clear:OPTION")) .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -56,12 +56,12 @@ class Bank extends BaseCommand { user: interaction.translate("economy/transactions:BANK"), amount: credits, date: Date.now(), - type: "send" + type: "send", }; data.memberData.transactions.push(info); interaction.success("economy/bank:SUCCESS_DEP", { - money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` + money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, }); } else { const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits"); @@ -72,7 +72,7 @@ class Bank extends BaseCommand { user: interaction.translate("economy/transactions:BANK"), amount: credits, date: Date.now(), - type: "got" + type: "got", }; data.memberData.transactions.push(info); @@ -82,7 +82,7 @@ class Bank extends BaseCommand { await data.memberData.save(); interaction.success("economy/bank:SUCCESS_WD", { - money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` + money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, }); } } diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js index 2c53af5c..cdaf95b9 100644 --- a/commands/Economy/birthdate.js +++ b/commands/Economy/birthdate.js @@ -30,14 +30,14 @@ class Birthdate extends BaseCommand { { name: "Сентябрь", value: 9 }, { name: "Октябрь", value: 10 }, { name: "Ноябрь", value: 11 }, - { name: "Декабрь", value: 12 } + { name: "Декабрь", value: 12 }, )) .addIntegerOption(option => option.setName("year") .setDescription(client.translate("economy/birthdate:YEAR")) .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -67,7 +67,7 @@ class Birthdate extends BaseCommand { await data.userData.save(); interaction.success("economy/birthdate:SUCCESS", { - date: client.printDate(d) + date: client.printDate(d), }); } } diff --git a/commands/Economy/divorce.js b/commands/Economy/divorce.js index 2885c44a..c6b4944f 100644 --- a/commands/Economy/divorce.js +++ b/commands/Economy/divorce.js @@ -14,7 +14,7 @@ class Divorce extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -38,19 +38,19 @@ class Divorce extends BaseCommand { await data.userData.save(); const oldLover = await client.findOrCreateUser({ - id: user.id + id: user.id, }); oldLover.lover = null; await oldLover.save(); interaction.success("economy/divorce:DIVORCED", { - user: user.toString() + user: user.toString(), }); user.send({ content: interaction.translate("economy/divorce:DIVORCED_U", { - user: interaction.member.toString() - }) + user: interaction.member.toString(), + }), }); } } diff --git a/commands/Economy/importmee6.js b/commands/Economy/importmee6.js index d143307e..0b7c9cc8 100644 --- a/commands/Economy/importmee6.js +++ b/commands/Economy/importmee6.js @@ -15,7 +15,7 @@ class ImportMee6 extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -42,8 +42,8 @@ class ImportMee6 extends BaseCommand { interaction.editReply({ content: interaction.translate("owner/debug:SUCCESS_LEVEL", { username: interaction.member.toString(), - amount: level - }) + amount: level, + }), }); } } diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js index 363d6c4c..59e43dcd 100644 --- a/commands/Economy/leaderboard.js +++ b/commands/Economy/leaderboard.js @@ -26,11 +26,11 @@ class Leaderboard extends BaseCommand { .addChoices( { name: client.translate("economy/leaderboard:LEVEL"), value: "level" }, { name: client.translate("economy/leaderboard:MONEY"), value: "money" }, - { name: client.translate("economy/leaderboard:REP"), value: "rep" } + { name: client.translate("economy/leaderboard:REP"), value: "rep" }, )), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -53,7 +53,7 @@ class Leaderboard extends BaseCommand { const isOnMobile = JSON.stringify(Object.keys(interaction.member.presence.clientStatus)) === JSON.stringify(["mobile"]); if (isOnMobile) interaction.followUp({ content: interaction.translate("economy/leaderboard:MOBILE"), - ephemeral: true + ephemeral: true, }); if (type === "money") { @@ -63,7 +63,7 @@ class Leaderboard extends BaseCommand { await asyncForEach(membersData, async member => { membersLeaderboard.push({ id: member.id, - money: member.money + member.bankSold + money: member.money + member.bankSold, }); }); membersLeaderboard.sort((a, b) => b.money - a.money); @@ -81,23 +81,23 @@ class Leaderboard extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("economy/leaderboard:TABLE", { - name: interaction.guild.name + name: interaction.guild.name, }), - iconURL: interaction.guild.iconURL() + iconURL: interaction.guild.iconURL(), }) .setColor(client.config.embed.color) .addFields({ name: interaction.translate("common:USER"), value: userNames, - inline: true + inline: true, }, { name: interaction.translate("common:CREDITS"), value: money, - inline: true + inline: true, }); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } else if (type === "level") { const membersLeaderboard = [], @@ -107,7 +107,7 @@ class Leaderboard extends BaseCommand { membersLeaderboard.push({ id: member.id, level: member.level, - xp: member.exp + xp: member.exp, }); }); membersLeaderboard.sort((a, b) => b.level - a.level); @@ -127,31 +127,31 @@ class Leaderboard extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("economy/leaderboard:TABLE", { - name: interaction.guild.name + name: interaction.guild.name, }), - iconURL: interaction.guild.iconURL() + iconURL: interaction.guild.iconURL(), }) .setColor(client.config.embed.color) .addFields([ { name: interaction.translate("common:USER"), value: userNames.join("\n"), - inline: true + inline: true, }, { name: interaction.translate("common:LEVEL"), value: level.join("\n"), - inline: true + inline: true, }, { name: interaction.translate("common:XP"), value: xp.join("\n"), - inline: true - } + inline: true, + }, ]); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } else if (type === "rep") { const usersLeaderboard = [], @@ -160,7 +160,7 @@ class Leaderboard extends BaseCommand { await asyncForEach(usersData, async user => { usersLeaderboard.push({ id: user.id, - rep: user.rep + rep: user.rep, }); }); usersLeaderboard.sort((a, b) => b.rep - a.rep); @@ -178,23 +178,23 @@ class Leaderboard extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("economy/leaderboard:TABLE", { - name: interaction.guild.name + name: interaction.guild.name, }), - iconURL: interaction.guild.iconURL() + iconURL: interaction.guild.iconURL(), }) .setColor(client.config.embed.color) .addFields({ name: interaction.translate("common:USER"), value: userNames, - inline: true + inline: true, }, { name: interaction.translate("common:REP"), value: rep, - inline: true + inline: true, }); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js index 5f27cffb..1d520a81 100644 --- a/commands/Economy/marry.js +++ b/commands/Economy/marry.js @@ -18,7 +18,7 @@ class Marry extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -40,7 +40,7 @@ class Marry extends BaseCommand { if (member.user.bot) return interaction.error("economy/marry:BOT_USER"); if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF"); const userData = await client.findOrCreateUser({ - id: member.id + id: member.id, }); if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() }); @@ -50,24 +50,24 @@ class Marry extends BaseCommand { if (requester === interaction.author.id) { const user = client.users.cache.get(receiver) || await client.users.fetch(receiver); return interaction.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", { - user: user.toString + user: user.toString, }); } else if (receiver === interaction.member.id) { const user = client.users.cache.get(requester) || await client.users.fetch(requester); return interaction.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", { - user: user.toString() + user: user.toString(), }); } else if (requester === member.id) { const user = client.users.cache.get(receiver) || await client.users.fetch(receiver); return interaction.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", { firstUser: member.toString(), - secondUser: user.toString() + secondUser: user.toString(), }); } else if (receiver === member.id) { const user = client.users.cache.get(requester) || await client.users.fetch(requester); return interaction.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", { firstUser: member.toString(), - secondUser: user.toString() + secondUser: user.toString(), }); } } @@ -89,9 +89,9 @@ class Marry extends BaseCommand { await interaction.reply({ content: interaction.translate("economy/marry:REQUEST", { to: member.toString(), - from: interaction.member.toString() + from: interaction.member.toString(), }), - components: [row] + components: [row], }); const filter = i => i.user.id === member.id; @@ -112,7 +112,7 @@ class Marry extends BaseCommand { }); return interaction.editReply({ - components: [row] + components: [row], }); } @@ -126,8 +126,8 @@ class Marry extends BaseCommand { content: `${member.toString()} :heart: ${interaction.member.toString()}`, files: [{ name: "achievement_unlocked3.png", - attachment: "./assets/img/achievements/achievement_unlocked3.png" - }] + attachment: "./assets/img/achievements/achievement_unlocked3.png", + }], }; let sent = false; @@ -151,17 +151,17 @@ class Marry extends BaseCommand { return interaction.editReply({ content: interaction.translate("economy/marry:SUCCESS", { creator: interaction.member.toString(), - partner: member.toString() + partner: member.toString(), }), - components: [] + components: [], }); } else { return interaction.editReply({ content: interaction.translate("economy/marry:DENIED", { creator: interaction.member.toString(), - partner: member.toString() + partner: member.toString(), }), - components: [] + components: [], }); } }); diff --git a/commands/Economy/money.js b/commands/Economy/money.js index 46530343..42af4969 100644 --- a/commands/Economy/money.js +++ b/commands/Economy/money.js @@ -24,7 +24,7 @@ class Money extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -48,7 +48,7 @@ class Money extends BaseCommand { const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id)); @@ -56,7 +56,7 @@ class Money extends BaseCommand { await asyncForEach(guilds, async guild => { const data = await client.findOrCreateMember({ id: member.id, - guildId: guild.id + guildId: guild.id, }); globalMoney += data.money + data.bankSold; }); @@ -64,33 +64,33 @@ class Money extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("economy/money:TITLE", { - username: member.user.tag + username: member.user.tag, }), - iconURL: member.user.displayAvatarURL() + iconURL: member.user.displayAvatarURL(), }) .addFields([ { name: interaction.translate("economy/profile:CASH"), value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:BANK"), value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:GLOBAL"), value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - inline: true - } + inline: true, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Economy/number.js b/commands/Economy/number.js index f4239713..4aa45097 100644 --- a/commands/Economy/number.js +++ b/commands/Economy/number.js @@ -15,7 +15,7 @@ class Number extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -44,7 +44,7 @@ class Number extends BaseCommand { const filter = m => !m.author.bot; const collector = new MessageCollector(interaction.channel, { filter, - time: (5 * 60 * 1000) + time: (5 * 60 * 1000), }); currentGames[interaction.guildId] = true; @@ -63,8 +63,8 @@ class Number extends BaseCommand { number, time, participantCount: participants.length, - participants: participants.map(p => `<@${p}>`).join(", ") - }) + participants: participants.map(p => `<@${p}>`).join(", "), + }), }); if (participants.length > 1) { @@ -73,13 +73,13 @@ class Number extends BaseCommand { interaction.channel.send({ content: interaction.translate("economy/number:WON", { winner: msg.author.username, - credits: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` - }) + credits: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, + }), }); const memberData = await client.findOrCreateMember({ id: msg.author.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); memberData.money += won; @@ -88,7 +88,7 @@ class Number extends BaseCommand { user: interaction.translate("economy/transactions:NUMBERS"), amount: won, date: Date.now(), - type: "got" + type: "got", }; data.memberData.transactions.push(info); @@ -98,10 +98,10 @@ class Number extends BaseCommand { } if (parseInt(msg.content) < number) msg.reply({ - content: interaction.translate("economy/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }) + content: interaction.translate("economy/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }), }); if (parseInt(msg.content) > number) msg.reply({ - content: interaction.translate("economy/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }) + content: interaction.translate("economy/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }), }); }); diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js index 7c6ec732..6bbbf422 100644 --- a/commands/Economy/pay.js +++ b/commands/Economy/pay.js @@ -20,7 +20,7 @@ class Pay extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -45,12 +45,12 @@ class Pay extends BaseCommand { if (amount > data.memberData.money) return interaction.error("economy/pay:ENOUGH_MONEY", { - amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}` + amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`, }); const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); data.memberData.money -= amount; @@ -63,7 +63,7 @@ class Pay extends BaseCommand { user: member.user.tag, amount: amount, date: Date.now(), - type: "send" + type: "send", }; data.memberData.transactions.push(info1); @@ -71,13 +71,13 @@ class Pay extends BaseCommand { user: member.user.tag, amount: amount, date: Date.now(), - type: "got" + type: "got", }; data.memberData.transactions.push(info2); interaction.success("economy/pay:SUCCESS", { user: member.toString(), - amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` + amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, }); } } diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index 29b0fb7f..1513cebf 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -24,7 +24,7 @@ class Profile extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -48,10 +48,10 @@ class Profile extends BaseCommand { const memberData = (member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, })); const userData = (member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ - id: member.id + id: member.id, })); if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true); @@ -60,7 +60,7 @@ class Profile extends BaseCommand { await asyncForEach(guilds, async guild => { const data = await client.findOrCreateMember({ id: member.id, - guildId: guild.id + guildId: guild.id, }); globalMoney += data.money + data.bankSold; }); @@ -68,73 +68,73 @@ class Profile extends BaseCommand { const profileEmbed = new EmbedBuilder() .setAuthor({ name: interaction.translate("economy/profile:TITLE", { - user: member.nickname + user: member.nickname, }), - iconURL: member.displayAvatarURL() + iconURL: member.displayAvatarURL(), }) .setImage("attachment://achievements.png") .addFields([ { name: client.customEmojis.link + " " + interaction.translate("economy/profile:LINK"), - value: `[${interaction.translate("economy/profile:LINK_TEXT")}](${client.config.dashboard.baseURL}/user/${member.user.id}/${interaction.guild.id})` + value: `[${interaction.translate("economy/profile:LINK_TEXT")}](${client.config.dashboard.baseURL}/user/${member.user.id}/${interaction.guild.id})`, }, { name: interaction.translate("economy/profile:BIO"), - value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN") + value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN"), }, { name: interaction.translate("economy/profile:CASH"), value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:BANK"), value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:GLOBAL"), value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:REPUTATION"), value: `**${userData.rep}** ${client.getNoun(userData.rep, interaction.translate("misc:NOUNS:POINTS:1"), interaction.translate("misc:NOUNS:POINTS:2"), interaction.translate("misc:NOUNS:POINTS:5"))}`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:LEVEL"), value:`**${memberData.level}**`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:XP"), value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, - inline: true + inline: true, }, { name: interaction.translate("economy/profile:REGISTERED"), value: client.printDate(new Date(memberData.registeredAt)), - inline: true + inline: true, }, { name: interaction.translate("economy/profile:BIRTHDATE"), value: (!userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.printDate(new Date(userData.birthdate))), - inline: true + inline: true, }, { name: interaction.translate("economy/profile:LOVER"), value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : client.users.cache.get(userData.lover).tag), - inline: true + inline: true, }, { name: interaction.translate("economy/profile:ACHIEVEMENTS"), - value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT") - } + value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT"), + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setTimestamp(); @@ -144,8 +144,8 @@ class Profile extends BaseCommand { embeds: [profileEmbed], files: [{ name: "achievements.png", - attachment: buffer - }] + attachment: buffer, + }], }); } } diff --git a/commands/Economy/rep.js b/commands/Economy/rep.js index 4d3c410d..463fea7f 100644 --- a/commands/Economy/rep.js +++ b/commands/Economy/rep.js @@ -17,7 +17,7 @@ class Rep extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,7 +37,7 @@ class Rep extends BaseCommand { const isInCooldown = data.userData.cooldowns?.rep; if (isInCooldown) { if (isInCooldown > Date.now()) return interaction.error("economy/rep:COOLDOWN", { - time: client.convertTime(isInCooldown, true, true, data.guildData.language) + time: client.convertTime(isInCooldown, true, true, data.guildData.language), }); } @@ -52,7 +52,7 @@ class Rep extends BaseCommand { await data.userData.save(); const userData = await client.findOrCreateUser({ - id: user.id + id: user.id, }); userData.rep++; @@ -64,8 +64,8 @@ class Rep extends BaseCommand { content: `${user}`, files: [{ name: "achievement_unlocked6.png", - attachment: "./assets/img/achievements/achievement_unlocked6.png" - }] + attachment: "./assets/img/achievements/achievement_unlocked6.png", + }], }); } userData.markModified("achievements.rep"); @@ -73,7 +73,7 @@ class Rep extends BaseCommand { await userData.save(); interaction.success("economy/rep:SUCCESS", { - user: user.toString() + user: user.toString(), }); } } diff --git a/commands/Economy/rob.js b/commands/Economy/rob.js index 9acb7988..5a304078 100644 --- a/commands/Economy/rob.js +++ b/commands/Economy/rob.js @@ -20,7 +20,7 @@ class Rob extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -45,7 +45,7 @@ class Rob extends BaseCommand { const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); if (amount > memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.toString() }); @@ -57,7 +57,7 @@ class Rob extends BaseCommand { const potentiallyLose = Math.floor(amount * 1.5); if (potentiallyLose > data.memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", { moneyMin: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - moneyCurrent: `**${data.memberData.money}** ${client.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` + moneyCurrent: `**${data.memberData.money}** ${client.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, }); const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25); @@ -70,7 +70,7 @@ class Rob extends BaseCommand { const randomNum = client.functions.randomNum(1, 2); interaction.replyT("economy/rob:ROB_WON_" + randomNum, { money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - user: member.toString() + user: member.toString(), }); data.memberData.money += amount; memberData.money -= amount; @@ -82,7 +82,7 @@ class Rob extends BaseCommand { interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, { fine: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, offset: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - user: member.toString() + user: member.toString(), }); data.memberData.money -= potentiallyLose; memberData.money += won; diff --git a/commands/Economy/setbio.js b/commands/Economy/setbio.js index ee457386..f2f4cd2a 100644 --- a/commands/Economy/setbio.js +++ b/commands/Economy/setbio.js @@ -17,7 +17,7 @@ class Setbio extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js index 24bb0644..972c7441 100644 --- a/commands/Economy/slots.js +++ b/commands/Economy/slots.js @@ -17,7 +17,7 @@ class Slots extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -48,7 +48,7 @@ class Slots extends BaseCommand { const colonnes = [ client.functions.shuffle(fruits), client.functions.shuffle(fruits), - client.functions.shuffle(fruits) + client.functions.shuffle(fruits), ]; function getCredits(number, isJackpot) { @@ -87,7 +87,7 @@ class Slots extends BaseCommand { if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) { msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |"; await interaction.editReply({ - content: msg + content: msg, }); const credits = getCredits(amount, true); @@ -95,8 +95,8 @@ class Slots extends BaseCommand { content: "**!! ДЖЕКПОТ !!**\n" + interaction.translate("economy/slots:VICTORY", { money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - user: interaction.member.toString() - }) + user: interaction.member.toString(), + }), }); const toAdd = credits - amount; @@ -107,7 +107,7 @@ class Slots extends BaseCommand { user: interaction.translate("economy/slots:DESCRIPTION"), amount: toAdd, date: Date.now(), - type: "got" + type: "got", }; data.memberData.transactions.push(info); @@ -118,8 +118,8 @@ class Slots extends BaseCommand { interaction.followUp({ files: [{ name: "achievement_unlocked4.png", - attachment: "./assets/img/achievements/achievement_unlocked4.png" - }] + attachment: "./assets/img/achievements/achievement_unlocked4.png", + }], }); } data.userData.markModified("achievements.slots"); @@ -132,7 +132,7 @@ class Slots extends BaseCommand { if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) { msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |"; await interaction.editReply({ - content: msg + content: msg, }); const credits = getCredits(amount, false); @@ -140,8 +140,8 @@ class Slots extends BaseCommand { content: interaction.translate("economy/slots:VICTORY", { money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - user: interaction.member.toString() - }) + user: interaction.member.toString(), + }), }); const toAdd = credits - amount; @@ -149,7 +149,7 @@ class Slots extends BaseCommand { user: interaction.translate("economy/slots:DESCRIPTION"), amount: toAdd, date: Date.now(), - type: "got" + type: "got", }; data.memberData.transactions.push(info); data.memberData.money += toAdd; @@ -161,8 +161,8 @@ class Slots extends BaseCommand { interaction.followUp({ files: [{ name: "achievement_unlocked4.png", - attachment: "./assets/img/achievements/achievement_unlocked4.png" - }] + attachment: "./assets/img/achievements/achievement_unlocked4.png", + }], }); } data.userData.markModified("achievements.slots"); @@ -176,15 +176,15 @@ class Slots extends BaseCommand { interaction.followUp({ content: interaction.translate("economy/slots:DEFEAT", { money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, - user: interaction.member.toString() - }) + user: interaction.member.toString(), + }), }); const info = { user: interaction.translate("economy/slots:DESCRIPTION"), amount: amount, date: Date.now(), - type: "send" + type: "send", }; data.memberData.transactions.push(info); data.memberData.money -= amount; @@ -216,7 +216,7 @@ class Slots extends BaseCommand { msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n"; await interaction.editReply({ - content: msg + content: msg, }); } } diff --git a/commands/Economy/tictactoe.js b/commands/Economy/tictactoe.js index 65a6ac16..c122601a 100644 --- a/commands/Economy/tictactoe.js +++ b/commands/Economy/tictactoe.js @@ -18,7 +18,7 @@ class TicTacToe extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -38,11 +38,11 @@ class TicTacToe extends BaseCommand { tictactoe(interaction, { resultBtn: true, embedColor: client.config.embed.color, - embedFoot: client.config.embed.footer + embedFoot: client.config.embed.footer, }).then(async winner => { const memberData = await client.findOrCreateMember({ id: winner.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); memberData.money += 100; @@ -52,7 +52,7 @@ class TicTacToe extends BaseCommand { user: interaction.translate("economy/transactions:TTT"), amount: 100, date: Date.now(), - type: "got" + type: "got", }; memberData.transactions.push(info); }); diff --git a/commands/Economy/transactions.js b/commands/Economy/transactions.js index 57568606..ad849391 100644 --- a/commands/Economy/transactions.js +++ b/commands/Economy/transactions.js @@ -16,7 +16,7 @@ class Transactions extends BaseCommand { .setDescription(client.translate("economy/transactions:CLEAR"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -43,11 +43,11 @@ class Transactions extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"), - iconURL: interaction.member.displayAvatarURL() + iconURL: interaction.member.displayAvatarURL(), }) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); const transactions = data.memberData.transactions, @@ -65,20 +65,20 @@ class Transactions extends BaseCommand { { name: interaction.translate("economy/transactions:T_GOT"), value: sortedTransactions[0].join("\n"), - inline: true - } + inline: true, + }, ]); if (sortedTransactions[1].length > 0) embed.addFields([ { name: interaction.translate("economy/transactions:T_SEND"), value: sortedTransactions[1].join("\n"), - inline: true - } + inline: true, + }, ]); } interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Economy/work.js b/commands/Economy/work.js index be1bd0cc..b2deb146 100644 --- a/commands/Economy/work.js +++ b/commands/Economy/work.js @@ -14,7 +14,7 @@ class Work extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -34,7 +34,7 @@ class Work extends BaseCommand { const isInCooldown = data.memberData.cooldowns?.work; if (isInCooldown) { if (isInCooldown > Date.now()) return interaction.error("economy/work:COOLDOWN", { - time: client.convertTime(isInCooldown, true, true, data.guildData.language) + time: client.convertTime(isInCooldown, true, true, data.guildData.language), }); } if (Date.now() > data.memberData.cooldowns.work + (24 * 60 * 60 * 1000)) data.memberData.workStreak = 0; @@ -49,7 +49,7 @@ class Work extends BaseCommand { const embed = new EmbedBuilder() .setFooter({ text: interaction.translate("economy/work:AWARD"), - iconURL: interaction.member.displayAvatarURL() + iconURL: interaction.member.displayAvatarURL(), }) .setColor(client.config.embed.color); @@ -58,7 +58,7 @@ class Work extends BaseCommand { client.customEmojis.letters.w, client.customEmojis.letters.a, client.customEmojis.letters.r, - client.customEmojis.letters.d + client.customEmojis.letters.d, ]; let won = 200; @@ -68,13 +68,13 @@ class Work extends BaseCommand { { name: interaction.translate("economy/work:SALARY"), value: interaction.translate("economy/work:SALARY_CONTENT", { - won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` - }) + won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, + }), }, { name: interaction.translate("economy/work:STREAK"), - value: interaction.translate("economy/work:STREAK_CONTENT") - } + value: interaction.translate("economy/work:STREAK_CONTENT"), + }, ]); data.memberData.workStreak = 0; } else { @@ -88,13 +88,13 @@ class Work extends BaseCommand { { name: interaction.translate("economy/work:SALARY"), value: interaction.translate("economy/work:SALARY_CONTENT", { - won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` - }) + won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, + }), }, { name: interaction.translate("economy/work:STREAK"), - value: award.join("") - } + value: award.join(""), + }, ]); } @@ -105,19 +105,19 @@ class Work extends BaseCommand { user: interaction.translate("economy/work:SALARY"), amount: won, date: Date.now(), - type: "got" + type: "got", }; data.memberData.transactions.push(info); const messageOptions = { - embeds: [embed] + embeds: [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" + attachment: "./assets/img/achievements/achievement_unlocked1.png", }]; data.userData.achievements.work.achieved = true; } diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js index 55a23d18..9be2a269 100644 --- a/commands/Fun/8ball.js +++ b/commands/Fun/8ball.js @@ -17,7 +17,7 @@ class Eightball extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -42,7 +42,7 @@ class Eightball extends BaseCommand { interaction.replyT("fun/8ball:ANSWER", { question, - answer + answer, }, { edit: true }); } } diff --git a/commands/Fun/cat.js b/commands/Fun/cat.js index c48a94ef..0746d57a 100644 --- a/commands/Fun/cat.js +++ b/commands/Fun/cat.js @@ -15,7 +15,7 @@ class Cat extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,7 +37,7 @@ class Cat extends BaseCommand { const res = await fetch("https://and-here-is-my-code.glitch.me/img/cat").then(response => response.json()); interaction.editReply({ - content: res.Link + content: res.Link, }); } } diff --git a/commands/Fun/crab.js b/commands/Fun/crab.js index f7c5c71f..efeeadef 100644 --- a/commands/Fun/crab.js +++ b/commands/Fun/crab.js @@ -15,7 +15,7 @@ class Crab extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,7 +37,7 @@ class Crab extends BaseCommand { const res = await fetch("https://and-here-is-my-code.glitch.me/img/crab").then(response => response.json()); interaction.editReply({ - content: res.Link + content: res.Link, }); } } diff --git a/commands/Fun/dog.js b/commands/Fun/dog.js index 0106eafc..146de921 100644 --- a/commands/Fun/dog.js +++ b/commands/Fun/dog.js @@ -15,7 +15,7 @@ class Dog extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,7 +37,7 @@ class Dog extends BaseCommand { const res = await fetch("https://and-here-is-my-code.glitch.me/img/dog").then(response => response.json()); interaction.editReply({ - content: res.Link + content: res.Link, }); } } diff --git a/commands/Fun/lmgtfy.js b/commands/Fun/lmgtfy.js index ff8c8321..876b5912 100644 --- a/commands/Fun/lmgtfy.js +++ b/commands/Fun/lmgtfy.js @@ -21,7 +21,7 @@ class LMGTFY extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -47,12 +47,12 @@ class LMGTFY extends BaseCommand { interaction.reply({ content: `<${res}>`, - ephemeral: true + ephemeral: true, }); } else { interaction.reply({ content: `<${url}>`, - ephemeral: true + ephemeral: true, }); } } diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js index 4a92eb35..9caf92b9 100644 --- a/commands/Fun/lovecalc.js +++ b/commands/Fun/lovecalc.js @@ -22,7 +22,7 @@ class Lovecalc extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -53,20 +53,20 @@ class Lovecalc extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ - name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}` + name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`, }) .setDescription(interaction.translate("fun/lovecalc:CONTENT", { percent, firstMember: firstMember, - secondMember: secondMember + secondMember: secondMember, })) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Fun/memes.js b/commands/Fun/memes.js index c0af1d98..89e1316c 100644 --- a/commands/Fun/memes.js +++ b/commands/Fun/memes.js @@ -15,7 +15,7 @@ class Memes extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,8 +37,8 @@ class Memes extends BaseCommand { const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag => JSON.parse(JSON.stringify({ label: tag, - value: tag - })) + value: tag, + })), ); const row = new ActionRowBuilder() @@ -46,13 +46,13 @@ class Memes extends BaseCommand { new SelectMenuBuilder() .setCustomId("memes_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(tags) + .addOptions(tags), ); const msg = await interaction.editReply({ content: interaction.translate("common:AVAILABLE_OPTIONS"), fetchReply: true, - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -68,7 +68,7 @@ class Memes extends BaseCommand { const embed = new EmbedBuilder() .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setTitle(res.title) .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`) @@ -76,14 +76,14 @@ class Memes extends BaseCommand { .setTimestamp(); await interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } }); collector.on("end", () => { return interaction.editReply({ - components: [] + components: [], }); }); } diff --git a/commands/General/activity.js b/commands/General/activity.js index 7f35e6d4..625ac575 100644 --- a/commands/General/activity.js +++ b/commands/General/activity.js @@ -15,7 +15,7 @@ class Activity extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -43,7 +43,7 @@ class Activity extends BaseCommand { const activities = defaultApplications.map(a => { return { label: `${a.name} ${a.premium_tier_level ? `(${interaction.translate("general/activity:BOOST_NEEDED")})` : ""}`, - value: a.id + value: a.id, }; }); @@ -52,12 +52,12 @@ class Activity extends BaseCommand { new SelectMenuBuilder() .setCustomId("activity_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(activities) + .addOptions(activities), ); await interaction.editReply({ content: interaction.translate("general/activity:AVAILABLE_ACTIVITIES"), - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -73,23 +73,23 @@ class Activity extends BaseCommand { .setColor(client.config.embed.color) .setDescription(`**[${interaction.translate("general/activity:CLICK_HERE", { activity: defaultApplications.find(a => a.id === activity).name, - channel: voice.name + channel: voice.name, })}](${invite.code})**`) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setTimestamp(); await interaction.editReply({ embeds: [embed], - components: [] + components: [], }); } }); collector.on("end", () => { return interaction.editReply({ - components: [] + components: [], }); }); } diff --git a/commands/General/afk.js b/commands/General/afk.js index 21c1893d..09b13d50 100644 --- a/commands/General/afk.js +++ b/commands/General/afk.js @@ -17,7 +17,7 @@ class Afk extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -40,7 +40,7 @@ class Afk extends BaseCommand { data.userData.save(); interaction.success("general/afk:SUCCESS", { - reason + reason, }, { ephemeral: true }); } } diff --git a/commands/General/avatar.js b/commands/General/avatar.js index a90eb7ac..cfa50bc1 100644 --- a/commands/General/avatar.js +++ b/commands/General/avatar.js @@ -16,7 +16,7 @@ class Avatar extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -35,13 +35,13 @@ class Avatar extends BaseCommand { async execute(client, interaction) { const user = interaction.options.getUser("user") || interaction.user; const avatarURL = user.displayAvatarURL({ - size: 512 + size: 512, }); interaction.reply({ files: [{ - attachment: avatarURL - }] + attachment: avatarURL, + }], }); } } diff --git a/commands/General/emoji.js b/commands/General/emoji.js index fa6e813b..62eb01c9 100644 --- a/commands/General/emoji.js +++ b/commands/General/emoji.js @@ -17,7 +17,7 @@ class Emoji extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -40,34 +40,34 @@ class Emoji extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("general/emoji:TITLE", { - emoji: parsedEmoji.name - }) + emoji: parsedEmoji.name, + }), }) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .addFields([ { name: interaction.translate("common:NAME"), - value: parsedEmoji.name + value: parsedEmoji.name, }, { name: interaction.translate("general/emoji:ANIMATED"), - value: parsedEmoji.animated ? interaction.translate("common:YES") : interaction.translate("common:NO") + value: parsedEmoji.animated ? interaction.translate("common:YES") : interaction.translate("common:NO"), }, { name: interaction.translate("common:ID"), - value: parsedEmoji.id?.toString() || interaction.translate("general/emoji:STANDART") + value: parsedEmoji.id?.toString() || interaction.translate("general/emoji:STANDART"), }, { name: interaction.translate("general/emoji:LINK"), - value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}` - } + value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`, + }, ]); interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/General/help.js b/commands/General/help.js index 44cd5acd..d61d3d14 100644 --- a/commands/General/help.js +++ b/commands/General/help.js @@ -17,7 +17,7 @@ class Help extends BaseCommand { .setDescription(client.translate("common:COMMAND"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -52,7 +52,7 @@ class Help extends BaseCommand { const categoriesRows = categories.sort().map(c => { return { label: `${c} (${commands.filter(cmd => cmd.category === c).length})`, - value: c + value: c, }; }); @@ -61,13 +61,13 @@ class Help extends BaseCommand { new SelectMenuBuilder() .setCustomId("help_category_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(categoriesRows) + .addOptions(categoriesRows), ); const msg = await interaction.editReply({ content: interaction.translate("common:AVAILABLE_OPTIONS"), fetchReply: true, - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -81,36 +81,36 @@ class Help extends BaseCommand { const categoryCommands = commands.filter(cmd => cmd.category === arg).map(c => { return { name: `**${c.command.name}**`, - value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`) + value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`), }; }); const embed = new EmbedBuilder() .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setAuthor({ - name: interaction.translate("general/help:COMMANDS_IN", { category: arg }) + name: interaction.translate("general/help:COMMANDS_IN", { category: arg }), }) .addFields(categoryCommands) .addFields([ { name: "\u200B", - value: interaction.translate("general/help:INFO") - } + value: interaction.translate("general/help:INFO"), + }, ]); return interaction.editReply({ content: null, - embeds: [embed] + embeds: [embed], }); } }); collector.on("end", () => { return interaction.editReply({ - components: [] + components: [], }); }); } @@ -132,21 +132,21 @@ function generateCommandHelp(interaction, command) { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("general/help:CMD_TITLE", { - cmd: cmd.command.name - }) + cmd: cmd.command.name, + }), }) .addFields([ { name: interaction.translate("general/help:FIELD_DESCRIPTION"), - value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`) + value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`), }, { name: interaction.translate("general/help:FIELD_USAGE"), - value: `*${cmd.command.dm_permission === false ? interaction.translate("general/help:GUILD_ONLY") : interaction.translate("general/help:NOT_GUILD_ONLY")}*\n\n` + usage + value: `*${cmd.command.dm_permission === false ? interaction.translate("general/help:GUILD_ONLY") : interaction.translate("general/help:NOT_GUILD_ONLY")}*\n\n` + usage, }, { name: interaction.translate("general/help:FIELD_EXAMPLES"), - value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:EXAMPLES`) + value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:EXAMPLES`), }, // { // name: interaction.translate("general/help:FIELD_ALIASES"), @@ -154,12 +154,12 @@ function generateCommandHelp(interaction, command) { // }, { name: interaction.translate("general/help:FIELD_PERMISSIONS"), - value: cmd.command.default_member_permissions > 0 ? interaction.translate(`misc:PERMISSIONS:${getPermName(cmd.command.default_member_permissions)}`) : interaction.translate("general/help:NO_REQUIRED_PERMISSION") - } + value: cmd.command.default_member_permissions > 0 ? interaction.translate(`misc:PERMISSIONS:${getPermName(cmd.command.default_member_permissions)}`) : interaction.translate("general/help:NO_REQUIRED_PERMISSION"), + }, ]) .setColor(interaction.client.config.embed.color) .setFooter({ - text: interaction.client.config.embed.footer + text: interaction.client.config.embed.footer, }); return embed; diff --git a/commands/General/minecraft.js b/commands/General/minecraft.js index d8ed989e..6401201e 100644 --- a/commands/General/minecraft.js +++ b/commands/General/minecraft.js @@ -18,7 +18,7 @@ class Minecraft extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -40,7 +40,7 @@ class Minecraft extends BaseCommand { const ip = interaction.options.getString("ip"); const options = { type: "minecraft", - host: ip + host: ip, }; if (ip.split(":").length > 1) { @@ -49,7 +49,7 @@ class Minecraft extends BaseCommand { options.port = splitIp[1]; } - var res = await gamedig.query(options).catch(() => {}); + let res = await gamedig.query(options).catch(() => {}); if (!res) { options.type = "minecraftpe"; @@ -60,41 +60,41 @@ class Minecraft extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ - name: res.name + name: res.name, }) .addFields([ { name: interaction.translate("general/minecraft:FIELD_STATUS"), - value: interaction.translate("general/minecraft:ONLINE") + value: interaction.translate("general/minecraft:ONLINE"), }, { name: interaction.translate("general/minecraft:FIELD_CONNECTED"), - value: `**${(res.raw.players ? res.raw.players.online : res.players.length)}** ${client.getNoun((res.raw.players ? res.raw.players.online : res.players.length), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))} / **${(res.raw.players ? res.raw.players.max : res.maxplayers)}** ${client.getNoun((res.raw.players ? res.raw.players.max : res.maxplayers), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))}` + value: `**${(res.raw.players ? res.raw.players.online : res.players.length)}** ${client.getNoun((res.raw.players ? res.raw.players.online : res.players.length), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))} / **${(res.raw.players ? res.raw.players.max : res.maxplayers)}** ${client.getNoun((res.raw.players ? res.raw.players.max : res.maxplayers), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))}`, }, { name: interaction.translate("general/minecraft:FIELD_IP"), value: res.connect, - inline: true + inline: true, }, { name: interaction.translate("general/minecraft:FIELD_VERSION"), value: res.raw.vanilla.raw.version.name, - inline: true + inline: true, }, { name: interaction.translate("general/minecraft:FIELD_PING"), - value: res.raw.vanilla.ping.toString() - } + value: res.raw.vanilla.ping.toString(), + }, ]) .setColor(client.config.embed.color) .setThumbnail(`https://eu.mc-api.net/v3/server/favicon/${ip}`) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/General/ping.js b/commands/General/ping.js index b90b7cfe..930c86fe 100644 --- a/commands/General/ping.js +++ b/commands/General/ping.js @@ -14,7 +14,7 @@ class Ping extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -32,7 +32,7 @@ class Ping extends BaseCommand { */ async execute(client, interaction) { interaction.replyT("general/ping:CONTENT", { - ping: Math.round(client.ws.ping) + ping: Math.round(client.ws.ping), }); } } diff --git a/commands/General/remindme.js b/commands/General/remindme.js index f0888886..a1ba0e91 100644 --- a/commands/General/remindme.js +++ b/commands/General/remindme.js @@ -22,7 +22,7 @@ class Remindme extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -49,7 +49,7 @@ class Remindme extends BaseCommand { const rData = { message: message, createdAt: dateNow, - sendAt: dateNow + ms(time) + sendAt: dateNow + ms(time), }; data.userData.reminds.push(rData); @@ -59,7 +59,7 @@ class Remindme extends BaseCommand { interaction.success("general/remindme:SAVED", { message, - time: moment(rData.createdAt).locale(interaction.guild.data.language).format("dddd, Do MMMM YYYY, HH:mm:ss") + time: moment(rData.createdAt).locale(interaction.guild.data.language).format("dddd, Do MMMM YYYY, HH:mm:ss"), }, { edit: true }); } } diff --git a/commands/General/report.js b/commands/General/report.js index 92393284..9a895da9 100644 --- a/commands/General/report.js +++ b/commands/General/report.js @@ -20,7 +20,7 @@ class Report extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -46,51 +46,51 @@ class Report extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("general/report:TITLE", { - user: member.user.tag + user: member.user.tag, }), iconURL: interaction.user.displayAvatarURL({ extension: "png", - size: 512 - }) + size: 512, + }), }) .addFields([ { name: interaction.translate("common:DATE"), - value: client.printDate(new Date(Date.now())) + value: client.printDate(new Date(Date.now())), }, { name: interaction.translate("common:AUTHOR"), value: interaction.user.toString(), - inline: true + inline: true, }, { name: interaction.translate("common:USER"), value: member.user.toString(), - inline: true + inline: true, }, { name: interaction.translate("common:REASON"), value: rep, - inline: true - } + inline: true, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); const success = parseEmoji(client.customEmojis.cool).id; const error = parseEmoji(client.customEmojis.notcool).id; repChannel.send({ - embeds: [embed] + embeds: [embed], }).then(async m => { await m.react(success); await m.react(error); }); interaction.success("general/report:SUCCESS", { - channel: repChannel.toString() + channel: repChannel.toString(), }); } } diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js index bf2d51fc..eecce23d 100644 --- a/commands/General/serverinfo.js +++ b/commands/General/serverinfo.js @@ -14,7 +14,7 @@ class Serverinfo extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -39,66 +39,66 @@ class Serverinfo extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: guild.name, - iconURL: guild.iconURL() + iconURL: guild.iconURL(), }) .setThumbnail(guild.iconURL()) .addFields([ { name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"), - value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.baseURL}/stats/${guild.id})` + value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.baseURL}/stats/${guild.id})`, }, { name: client.customEmojis.title + interaction.translate("common:NAME"), value: guild.name, - inline: true + inline: true, }, { name: client.customEmojis.calendar + interaction.translate("common:CREATION"), value: client.printDate(guild.createdAt), - inline: true + inline: true, }, { name: client.customEmojis.users + interaction.translate("common:MEMBERS"), value: `${guild.members.cache.filter(m => !m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => !m.user.bot).size, interaction.translate("misc:NOUNS:MEMBERS:1"), interaction.translate("misc:NOUNS:MEMBERS:2"), interaction.translate("misc:NOUNS:MEMBERS:5"))}` + "\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => m.user.bot).size, interaction.translate("misc:NOUNS:BOTS:1"), interaction.translate("misc:NOUNS:BOTS:2"), interaction.translate("misc:NOUNS:BOTS:5"))}`, - inline: true + inline: true, }, { name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"), value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"), - inline: true + inline: true, }, { name: client.customEmojis.id + interaction.translate("common:SERVER_ID"), value: guild.id, - inline: true + inline: true, }, { name: client.customEmojis.crown + interaction.translate("common:OWNER"), value: owner.toString(), - inline: true + inline: true, }, { name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"), value: guild.premiumSubscriptionCount?.toString() || "0", - inline: true + inline: true, }, { name: client.customEmojis.channels + interaction.translate("common:CHANNELS"), value: `${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size, interaction.translate("misc:NOUNS:TEXT:1"), interaction.translate("misc:NOUNS:TEXT:2"), interaction.translate("misc:NOUNS:TEXT:5"))}` + "\n" + `${guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size} ${client.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size, interaction.translate("misc:NOUNS:VOICE:1"), interaction.translate("misc:NOUNS:VOICE:2"), interaction.translate("misc:NOUNS:VOICE:5"))}` + "\n" + `${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${client.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size, interaction.translate("misc:NOUNS:CATEGORY:1"), interaction.translate("misc:NOUNS:CATEGORY:2"), interaction.translate("misc:NOUNS:CATEGORY:5"))}`, - inline: true - } + inline: true, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js index b4adc1b9..a036b6da 100644 --- a/commands/General/shorturl.js +++ b/commands/General/shorturl.js @@ -18,7 +18,7 @@ class Shorturl extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -40,7 +40,7 @@ class Shorturl extends BaseCommand { interaction.reply({ content: `<${res}>`, - ephemeral: true + ephemeral: true, }); } } diff --git a/commands/General/staff.js b/commands/General/staff.js index 621ea3c4..0173ce8c 100644 --- a/commands/General/staff.js +++ b/commands/General/staff.js @@ -14,7 +14,7 @@ class Staff extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,26 +37,26 @@ class Staff extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("general/staff:TITLE", { - guild: interaction.guild.name - }) + guild: interaction.guild.name, + }), }) .addFields([ { name: interaction.translate("general/staff:ADMINS"), - value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")) + value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")), }, { name: interaction.translate("general/staff:MODS"), - value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")) - } + value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")), + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/General/stats.js b/commands/General/stats.js index 4b9ee4e5..5c7dec2a 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -1,4 +1,3 @@ - const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, version } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"); @@ -15,7 +14,7 @@ class Stats extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -39,10 +38,10 @@ class Stats extends BaseCommand { const statsEmbed = new EmbedBuilder() .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setAuthor({ - name: interaction.translate("common:STATS") + name: interaction.translate("common:STATS"), }) .setDescription(interaction.translate("general/stats:MADE")) .addFields([ @@ -50,35 +49,35 @@ class Stats extends BaseCommand { name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"), value: interaction.translate("general/stats:COUNTS_CONTENT", { servers: servers, - users: users + users: users, }), - inline: true + inline: true, }, { name: client.customEmojis.version + " " + interaction.translate("general/stats:VERSIONS_TITLE"), value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``, - inline: true + inline: true, }, { name: client.customEmojis.ram + " " + interaction.translate("general/stats:RAM_TITLE"), value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, - inline: true + inline: true, }, { name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"), value: interaction.translate("general/stats:ONLINE_CONTENT", { - time: client.convertTime(Date.now() + client.uptime, true, true, data.guildData.language) - }) + time: client.convertTime(Date.now() + client.uptime, true, true, data.guildData.language), + }), }, { name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"), value: interaction.translate("general/stats:MUSIC_CONTENT", { - count: `${client.player.queues.size} ${client.getNoun(client.player.queues.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}` - }) + count: `${client.player.queues.size} ${client.getNoun(client.player.queues.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}`, + }), }, { name: interaction.translate("general/stats:CREDITS_TITLE"), - value: interaction.translate("general/stats:CREDITS_CONTENT") + value: interaction.translate("general/stats:CREDITS_CONTENT"), }, { name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"), @@ -87,13 +86,13 @@ class Stats extends BaseCommand { docsLink: `${client.config.dashboard.baseURL}/docs/`, inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }), donateLink: "https://qiwi.com/n/JONNYBRO/", - owner: client.config.owner.id - }) - } + owner: client.config.owner.id, + }), + }, ]); interaction.reply({ - embeds: [statsEmbed] + embeds: [statsEmbed], }); } } diff --git a/commands/General/suggest.js b/commands/General/suggest.js index af0f0dbf..dc01678b 100644 --- a/commands/General/suggest.js +++ b/commands/General/suggest.js @@ -17,7 +17,7 @@ class Suggest extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -41,43 +41,43 @@ class Suggest extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("general/suggest:TITLE", { - user: interaction.user.tag + user: interaction.user.tag, }), - iconURL: interaction.member.displayAvatarURL() + iconURL: interaction.member.displayAvatarURL(), }) .addFields([ { name: interaction.translate("common:DATE"), - value: client.printDate(new Date(Date.now())) + value: client.printDate(new Date(Date.now())), }, { name: interaction.translate("common:AUTHOR"), value: interaction.user.toString(), - inline: true + inline: true, }, { name: interaction.translate("common:CONTENT"), value: suggestion, - inline: true - } + inline: true, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); const success = parseEmoji(client.customEmojis.cool).id; const error = parseEmoji(client.customEmojis.notcool).id; suggChannel.send({ - embeds: [embed] + embeds: [embed], }).then(async m => { await m.react(success); await m.react(error); }); interaction.success("general/suggest:SUCCESS", { - channel: suggChannel.toString() + channel: suggChannel.toString(), }); } } diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js index 57f28728..4c94aebe 100644 --- a/commands/General/userinfo.js +++ b/commands/General/userinfo.js @@ -16,7 +16,7 @@ class Userinfo extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -37,58 +37,58 @@ class Userinfo extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: `${member.user.tag} (${member.id})`, - iconURL: member.displayAvatarURL() + iconURL: member.displayAvatarURL(), }) .setThumbnail(member.displayAvatarURL({ - size: 512 + size: 512, })) .addFields([ { name: ":man: " + interaction.translate("common:USERNAME"), value: member.user.tag, - inline: true + inline: true, }, { name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"), value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"), - inline: true + inline: true, }, { name: client.customEmojis.status[member.presence.status] + " " + interaction.translate("common:STATUS"), value: interaction.translate(`common:STATUS_${member.presence.status.toUpperCase()}`), - inline: true + inline: true, }, { name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"), value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"), - inline: true + inline: true, }, { name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"), value: client.printDate(member.user.createdAt), - inline: true + inline: true, }, { name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"), value: client.printDate(member.joinedAt), - inline: true + inline: true, }, { name: client.customEmojis.color + " " + interaction.translate("common:COLOR"), value: member.displayHexColor, - inline: true + inline: true, }, { name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"), value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", { - count: member.roles.cache.size - 10 + count: member.roles.cache.size - 10, }) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")), - inline: true - } + inline: true, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); if (member.presence.activities[0]?.name === "Custom Status") { @@ -96,21 +96,21 @@ class Userinfo extends BaseCommand { { name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"), value: member.presence.activities[0] ? `${interaction.translate("general/userinfo:CUSTOM")}\n${member.presence.activities[0].state || interaction.translate("common:NOT_DEFINED")}` : interaction.translate("general/userinfo:NO_ACTIVITY"), - inline: true - } + inline: true, + }, ]); } else { embed.addFields([ { name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"), value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_ACTIVITY"), - inline: true - } + inline: true, + }, ]); } interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/General/whois.js b/commands/General/whois.js index ed470b5b..2cad1597 100644 --- a/commands/General/whois.js +++ b/commands/General/whois.js @@ -18,7 +18,7 @@ class Whois extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -42,10 +42,10 @@ class Whois extends BaseCommand { if (whois.status === "fail") return interaction.editReply({ content: interaction.translate("general/whois:ERROR", { ip }) }); const embed = new EmbedBuilder() .setTitle(interaction.translate("general/whois:INFO_ABOUT", { - ip + ip, })) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setColor(client.config.embed.color) .addFields( @@ -57,7 +57,7 @@ class Whois extends BaseCommand { { name: interaction.translate("general/whois:TIMEZONE"), value: `${whois.timezone || interaction.translate("common:UNKNOWN")}`, inline: true }, { name: interaction.translate("general/whois:CONTINENT"), value: `${whois.continent || interaction.translate("common:UNKNOWN")} (${whois.continentCode || interaction.translate("common:UNKNOWN")})`, inline: true }, { name: interaction.translate("general/whois:CURRENCY"), value: `${whois.currency || interaction.translate("common:UNKNOWN")}`, inline: true }, - { name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true } + { name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true }, ) .setTimestamp(); @@ -66,7 +66,7 @@ class Whois extends BaseCommand { else if (whois.hosting) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") }); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index 78b7ca1c..e12a1813 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -20,7 +20,7 @@ class Clear extends BaseCommand { .setDescription(client.translate("common:USER"))), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -57,7 +57,7 @@ class Clear extends BaseCommand { await interaction.editReply({ content: interaction.translate("moderation/clear:ALL_CONFIRM"), - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -74,7 +74,7 @@ class Clear extends BaseCommand { newChannel.setPosition(position); return newChannel.send({ - content: interaction.translate("moderation/clear:CHANNEL_CLEARED") + content: interaction.translate("moderation/clear:CHANNEL_CLEARED"), }); } else if (i.customId === "clear_confirm_no") { i.deferUpdate(); @@ -91,7 +91,7 @@ class Clear extends BaseCommand { interaction.editReply({ content: interaction.translate("misc:SELECT_CANCELED"), - components: [row] + components: [row], }); } else if (reason === "idle") { row.components.forEach(component => { @@ -99,14 +99,14 @@ class Clear extends BaseCommand { }); interaction.editReply({ - components: [row] + components: [row], }); } }); } else { if (isNaN(option) || parseInt(option) < 1) return interaction.error("misc:OPTION_NAN_ALL", null, { ephemeral: true }); let messages = await interaction.channel.messages.fetch({ - limit: option + limit: option, }); if (member) messages = messages.filter(m => m.author.id === member.id); if (messages.length > option) messages.length = parseInt(option, 10); @@ -116,11 +116,11 @@ class Clear extends BaseCommand { if (member) { interaction.replyT("moderation/clear:CLEARED_MEMBER", { amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`, - username: member.user.tag + username: member.user.tag, }, { ephemeral: true, edit: true }); } else { interaction.replyT("moderation/clear:CLEARED", { - amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}` + amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`, }, { ephemeral: true, edit: true }); } } diff --git a/commands/Moderation/clearwarns.js b/commands/Moderation/clearwarns.js index 80f6db2b..e4c1e88a 100644 --- a/commands/Moderation/clearwarns.js +++ b/commands/Moderation/clearwarns.js @@ -18,7 +18,7 @@ class Clearwarns extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -39,13 +39,13 @@ class Clearwarns extends BaseCommand { const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); memberData.sanctions = []; memberData.save(); interaction.success("moderation/clearwarns:SUCCESS", { - username: member.user.tag + username: member.user.tag, }); } } diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js index 2300734a..80e4f3d7 100644 --- a/commands/Moderation/giveaway.js +++ b/commands/Moderation/giveaway.js @@ -27,29 +27,29 @@ class Giveaway extends BaseCommand { .setRequired(true)) .addBooleanOption(option => option.setName("isdrop") .setDescription(client.translate("moderation/giveaway:ISDROP")) - .setRequired(true)) + .setRequired(true)), ) .addSubcommand(subcommand => subcommand.setName("reroll") .setDescription(client.translate("moderation/giveaway:REROLL")) .addStringOption(option => option.setName("giveaway_id") .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) - .setRequired(true)) + .setRequired(true)), ) .addSubcommand(subcommand => subcommand.setName("end") .setDescription(client.translate("moderation/giveaway:END")) .addStringOption(option => option.setName("giveaway_id") .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) - .setRequired(true)) + .setRequired(true)), ) .addSubcommand(subcommand => subcommand.setName("delete") .setDescription(client.translate("moderation/giveaway:DELETE")) .addStringOption(option => option.setName("giveaway_id") .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) - .setRequired(true)) + .setRequired(true)), ), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -99,8 +99,8 @@ class Giveaway extends BaseCommand { noWinner: interaction.translate("moderation/giveaway:NO_WINNER"), winners: interaction.translate("moderation/giveaway:WINNERS"), endedAt: interaction.translate("moderation/giveaway:END_AT"), - hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY") - } + hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"), + }, }).then(() => { return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true }); }); @@ -110,13 +110,13 @@ class Giveaway extends BaseCommand { client.giveawaysManager.reroll(giveaway_id, { messages: { congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"), - error: interaction.translate("moderation/giveaway:REROLL_ERROR") - } + error: interaction.translate("moderation/giveaway:REROLL_ERROR"), + }, }).then(() => { return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED"); }).catch(() => { return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", { - messageId: giveaway_id + messageId: giveaway_id, }, { ephemeral: true }); }); } else if (command === "end") { @@ -127,7 +127,7 @@ class Giveaway extends BaseCommand { return interaction.success("moderation/giveaway:GIVEAWAY_ENDED"); } catch (e) { return interaction.error("moderation/giveaway:NOT_FOUND", { - messageId: giveaway_id + messageId: giveaway_id, }, { ephemeral: true }); } } else if (command === "delete") { @@ -137,7 +137,7 @@ class Giveaway extends BaseCommand { return interaction.success("moderation/giveaway:GIVEAWAY_DELETED"); }).catch(() => { return interaction.error("moderation/giveaway:NOT_FOUND", { - messageId: giveaway_id + messageId: giveaway_id, }, { ephemeral: true }); }); } diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js index d4f27050..eb3afc1c 100644 --- a/commands/Moderation/poll.js +++ b/commands/Moderation/poll.js @@ -18,7 +18,7 @@ class Poll extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -61,7 +61,7 @@ class Poll extends BaseCommand { await interaction.reply({ content: interaction.translate("moderation/poll:SELECT_MENTION"), ephemeral: true, - components: [row] + components: [row], }); let mention = null; @@ -74,24 +74,24 @@ class Poll extends BaseCommand { mention = "||@everyone||"; i.update({ content: interaction.translate("moderation/poll:POLL_SENDED"), - components: [] + components: [], }); } else if (i.customId === "poll_here") { mention = "||@here||"; i.update({ content: interaction.translate("moderation/poll:POLL_SENDED"), - components: [] + components: [], }); } else if (i.customId === "poll_nothing") { mention = null; i.update({ content: interaction.translate("moderation/poll:POLL_SENDED"), - components: [] + components: [], }); } else if (i.customId === "poll_cancel") { return i.update({ content: interaction.translate("misc:SELECT_CANCELED"), - components: [] + components: [], }); } @@ -100,26 +100,26 @@ class Poll extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ - name: interaction.translate("moderation/poll:TITLE") + name: interaction.translate("moderation/poll:TITLE"), }) .setColor(client.config.embed.color) .addFields([ { name: "\u200b", - value: question + value: question, }, { name: "\u200b", value: interaction.translate("moderation/poll:REACT", { success: cool.toString(), - error: notcool.toString() - }) - } + error: notcool.toString(), + }), + }, ]); return interaction.channel.send({ content: mention, - embeds: [embed] + embeds: [embed], }).then(async m => { await m.react(cool); await m.react(notcool); diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js index 7740eb44..4d79e33e 100644 --- a/commands/Moderation/unban.js +++ b/commands/Moderation/unban.js @@ -18,7 +18,7 @@ class Unban extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -42,7 +42,7 @@ class Unban extends BaseCommand { interaction.guild.bans.remove(id); interaction.success("moderation/unban:UNBANNED", { - id + id, }); } } diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 90c1733f..8c3c0381 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -15,7 +15,7 @@ class Warn extends BaseCommand { .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers && PermissionFlagsBits.ManageMessages), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -41,7 +41,7 @@ class Warn extends BaseCommand { const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); const modal = new ModalBuilder() @@ -77,24 +77,24 @@ class Warn extends BaseCommand { date: Date.now(), type: "warn", case: data.guildData.casesCount, - reason + reason, }; const embed = new EmbedBuilder() .addFields([ { name: interaction.translate("common:USER"), - value: `\`${member.user.tag}\` (${member.user.toString()})` + value: `\`${member.user.tag}\` (${member.user.toString()})`, }, { name: interaction.translate("common:MODERATOR"), - value: `\`${interaction.user.tag}\` (${interaction.user.toString()})` + value: `\`${interaction.user.tag}\` (${interaction.user.toString()})`, }, { name: interaction.translate("common:REASON"), value: reason, - inline: true - } + inline: true, + }, ]); if (banCount) { @@ -104,20 +104,20 @@ class Warn extends BaseCommand { username: member.user, moderator: interaction.user.tag, server: interaction.guild.name, - reason - }) + reason, + }), }); caseInfo.type = "ban"; embed.setAuthor({ name: interaction.translate("moderation/ban:CASE", { - count: data.guildData.casesCount - }) + count: data.guildData.casesCount, + }), }) .setColor(client.config.embed.color); interaction.guild.members.ban(member); interaction.success("moderation/setwarns:AUTO_BAN", { username: member.user.tag, - count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}` + count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, }); } } @@ -129,20 +129,20 @@ class Warn extends BaseCommand { username: member.user, moderator: interaction.user.tag, server: interaction.guild.name, - reason - }) + reason, + }), }); caseInfo.type = "kick"; embed.setAuthor({ name: interaction.translate("moderation/kick:CASE", { - count: data.guildData.casesCount - }) + count: data.guildData.casesCount, + }), }) .setColor(client.config.embed.color); member.kick().catch(() => {}); interaction.success("moderation/setwarns:AUTO_KICK", { username: member.user.tag, - count: `${kickCount} ${client.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}` + count: `${kickCount} ${client.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, }); } } @@ -152,22 +152,22 @@ class Warn extends BaseCommand { username: member.user.tag, server: interaction.guild.name, moderator: interaction.user.tag, - reason - }) + reason, + }), }); caseInfo.type = "warn"; embed.setAuthor({ name: interaction.translate("moderation/warn:CASE", { - caseNumber: data.guildData.casesCount - }) + caseNumber: data.guildData.casesCount, + }), }).setColor(client.config.embed.color); submitted.reply({ content: interaction.translate("moderation/warn:WARNED", { user: member.toString(), - reason - }) + reason, + }), }); memberData.sanctions.push(caseInfo); @@ -177,7 +177,7 @@ class Warn extends BaseCommand { const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs); if (!channel) return; channel.send({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Moderation/warns.js b/commands/Moderation/warns.js index ab897374..6419a96a 100644 --- a/commands/Moderation/warns.js +++ b/commands/Moderation/warns.js @@ -18,7 +18,7 @@ class Warns extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -40,30 +40,30 @@ class Warns extends BaseCommand { const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); const embed = new EmbedBuilder() .setAuthor({ name: interaction.translate("moderation/warns:SANCTIONS_OF", { - member: member.nickname || member.user.username + member: member.nickname || member.user.username, }), iconURL: member.displayAvatarURL({ extension: "png", - size: 512 - }) + size: 512, + }), }) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); if (memberData.sanctions.length === 0) { embed.setDescription(interaction.translate("moderation/warns:NO_SANCTIONS", { - member: member.nickname || member.user.username + member: member.nickname || member.user.username, })); return interaction.reply({ - embeds: [embed] + embeds: [embed], }); } else { memberData.sanctions.forEach(sanction => { @@ -71,13 +71,13 @@ class Warns extends BaseCommand { { name: sanction.type + " | #" + sanction.case, value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`, - inline: true - } + inline: true, + }, ]); }); } interaction.reply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Music/back.js b/commands/Music/back.js index b9f6db07..e404e43a 100644 --- a/commands/Music/back.js +++ b/commands/Music/back.js @@ -14,7 +14,7 @@ class Back extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** diff --git a/commands/Music/clips.js b/commands/Music/clips.js index 00c40991..53ed4625 100644 --- a/commands/Music/clips.js +++ b/commands/Music/clips.js @@ -19,7 +19,7 @@ class Clips extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -43,7 +43,7 @@ class Clips extends BaseCommand { if (err) { interaction.editReply({ - content: "```js\n" + err + "```" + content: "```js\n" + err + "```", }); return console.log("Unable to read directory: " + err); } @@ -76,7 +76,7 @@ class Clips extends BaseCommand { await interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -92,7 +92,7 @@ class Clips extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); } } else if (i.customId === "clips_next_page") { @@ -103,7 +103,7 @@ class Clips extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); } } else if (i.customId === "clips_jump_page") { @@ -111,9 +111,9 @@ class Clips extends BaseCommand { const msg = await interaction.followUp({ content: interaction.translate("misc:JUMP_TO_PAGE", { - length: embeds.length + length: embeds.length, }), - fetchReply: true + fetchReply: true, }); const filter = res => { @@ -126,7 +126,7 @@ class Clips extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); if (collected.first().deletable) collected.first().delete(); @@ -150,7 +150,7 @@ class Clips extends BaseCommand { }); return interaction.editReply({ - components: [row] + components: [row], }); }); } else { @@ -165,7 +165,7 @@ class Clips extends BaseCommand { const connection = joinVoiceChannel({ channelId: voice.id, guildId: interaction.guild.id, - adapterCreator: interaction.guild.voiceAdapterCreator + adapterCreator: interaction.guild.voiceAdapterCreator, }); const resource = createAudioResource(fs.createReadStream(`./clips/${query}.mp3`)); @@ -187,9 +187,9 @@ class Clips extends BaseCommand { await interaction.editReply({ content: interaction.translate("music/clips:PLAYING", { - clip: query + clip: query, }), - components: [] + components: [], }); } }); @@ -215,7 +215,7 @@ function generateClipsEmbeds(interaction, clips) { const embed = new EmbedBuilder() .setColor(interaction.client.config.embed.color) .setFooter({ - text: interaction.client.config.embed.footer + text: interaction.client.config.embed.footer, }) .setTitle(interaction.translate("music/clips:CLIPS_LIST")) .setDescription(page) diff --git a/commands/Music/loop.js b/commands/Music/loop.js index eab0494f..7815a129 100644 --- a/commands/Music/loop.js +++ b/commands/Music/loop.js @@ -20,11 +20,11 @@ class Loop extends BaseCommand { { name: client.translate("music/loop:AUTOPLAY"), value: "3" }, { name: client.translate("music/loop:QUEUE"), value: "2" }, { name: client.translate("music/loop:TRACK"), value: "1" }, - { name: client.translate("music/loop:DISABLE"), value: "0" } + { name: client.translate("music/loop:DISABLE"), value: "0" }, )), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** diff --git a/commands/Music/nowplaying.js b/commands/Music/nowplaying.js index 0f992ebb..464ec4fc 100644 --- a/commands/Music/nowplaying.js +++ b/commands/Music/nowplaying.js @@ -15,7 +15,7 @@ class Nowplaying extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -41,34 +41,34 @@ class Nowplaying extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ - name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING") + name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"), }) .setThumbnail(track.thumbnail) .addFields([ { name: interaction.translate("music/nowplaying:T_TITLE"), value: `[${track.title}](${track.url})`, - inline: true + inline: true, }, { name: interaction.translate("music/nowplaying:T_AUTHOR"), value: track.author || interaction.translate("common:UNKNOWN"), - inline: true + inline: true, }, { name: "\u200B", value: "\u200B", inline: true }, { name: interaction.translate("common:VIEWS"), value: new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, { notation: "standard" }).format(track.views), - inline: true + inline: true, }, { name: interaction.translate("music/queue:ADDED"), value: track.requestedBy.toString(), - inline: true + inline: true, }, { name: interaction.translate("music/nowplaying:T_DURATION"), - value: progressBar + value: progressBar, }, { name: "\u200b", @@ -76,17 +76,17 @@ class Nowplaying extends BaseCommand { queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") : queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") : queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED") - }\`` - } + }\``, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setTimestamp(); interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/commands/Music/play.js b/commands/Music/play.js index 0a4c3f91..fc68dae2 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -17,7 +17,7 @@ class Play extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -43,8 +43,9 @@ class Play extends BaseCommand { if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true }); try { + // eslint-disable-next-line no-var var searchResult = await client.player.search(query, { - requestedBy: interaction.user + requestedBy: interaction.user, }); if (!searchResult.tracks[0] || !searchResult) @@ -54,8 +55,8 @@ class Play extends BaseCommand { return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, - error - }) + error, + }), }); } @@ -64,7 +65,7 @@ class Play extends BaseCommand { autoSelfDeaf: true, leaveOnEnd: true, leaveOnStop: true, - bufferingTimeout: 1000 + bufferingTimeout: 1000, }); if (searchResult.searched) { @@ -125,14 +126,14 @@ class Play extends BaseCommand { const embed = new EmbedBuilder() .setTitle(interaction.translate("music/play:RESULTS_TITLE", { - query + query, })) .setColor(client.config.embed.color) .setDescription(searchResult.tracks.map(track => { - var views; + let views; if (track.raw.live) views = "🔴 LIVE"; else views = new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, { - notation: "compact", compactDisplay: "short" + notation: "compact", compactDisplay: "short", }).format(track.views); return `${searchResult.tracks.indexOf(track) + 1}. [${track.title}](${track.url})\n> ${interaction.translate("common:VIEWS")}: **${views}**\n`; @@ -142,7 +143,7 @@ class Play extends BaseCommand { await interaction.editReply({ content: interaction.translate("music/play:SEARCH_RESULTS"), embeds: [embed], - components: [row1, row2, row3] + components: [row1, row2, row3], }); const filter = i => i.user.id === interaction.user.id; @@ -153,7 +154,7 @@ class Play extends BaseCommand { if (i.customId >= 1 && i.customId <= 10) { i.deferUpdate(); - var selected = searchResult.tracks[i.customId - 1]; + const selected = searchResult.tracks[i.customId - 1]; queue.addTrack(selected); try { @@ -162,10 +163,10 @@ class Play extends BaseCommand { interaction.editReply({ content: interaction.translate("music/play:ADDED_QUEUE", { - songName: selected.title + songName: selected.title, }), components: [], - embeds: [] + embeds: [], }); collector.stop(); @@ -175,21 +176,17 @@ class Play extends BaseCommand { console.log(error); return interaction.editReply({ content: interaction.translate("music/play:ERR_OCCURRED", { - error - }) + error, + }), }); } } else if (i.customId === "search_cancel") { i.deferUpdate(); - rows.forEach(row => { - row.components.forEach(component => { - component.setDisabled(true); - }); - }); - interaction.editReply({ - components: [row1, row2, row3] + content: interaction.translate("misc:SELECT_CANCELED"), + embeds: [], + components: [], }); collector.stop(); @@ -207,7 +204,7 @@ class Play extends BaseCommand { }); return interaction.editReply({ - components: [row1, row2, row3] + components: [row1, row2, row3], }); } }); @@ -223,16 +220,16 @@ class Play extends BaseCommand { interaction.editReply({ content: interaction.translate("music/play:ADDED_QUEUE", { - songName: searchResult.playlist ? searchResult.playlist.title : searchResult.tracks[0].title - }) + songName: searchResult.playlist ? searchResult.playlist.title : searchResult.tracks[0].title, + }), }); } catch (error) { client.player.deleteQueue(interaction.guildId); console.log(error); return interaction.editReply({ content: interaction.translate("music/play:ERR_OCCURRED", { - error - }) + error, + }), }); } } diff --git a/commands/Music/queue.js b/commands/Music/queue.js index 77f77799..69c7f264 100644 --- a/commands/Music/queue.js +++ b/commands/Music/queue.js @@ -15,7 +15,7 @@ class Queue extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -65,7 +65,7 @@ class Queue extends BaseCommand { await interaction.reply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -82,7 +82,7 @@ class Queue extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); } } else if (i.customId === "queue_next_page") { @@ -94,7 +94,7 @@ class Queue extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); } } else if (i.customId === "queue_jump_page") { @@ -103,9 +103,9 @@ class Queue extends BaseCommand { const msg = await interaction.followUp({ content: interaction.translate("misc:JUMP_TO_PAGE", { - length: embeds.length + length: embeds.length, }), - fetchReply: true + fetchReply: true, }); const filter = res => { @@ -118,7 +118,7 @@ class Queue extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); if (collected.first().deletable) collected.first().delete(); @@ -142,7 +142,7 @@ class Queue extends BaseCommand { }); return interaction.editReply({ - components: [row] + components: [row], }); }); } diff --git a/commands/Music/seek.js b/commands/Music/seek.js index 2f7cb94d..d15732f1 100644 --- a/commands/Music/seek.js +++ b/commands/Music/seek.js @@ -16,7 +16,7 @@ class Seek extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -41,7 +41,7 @@ class Seek extends BaseCommand { queue.seek(time * 1000); interaction.success("music/seek:SUCCESS", { - time: `**${time}** ${client.getNoun(time, interaction.translate("misc:NOUNS:SECONDS:1"), interaction.translate("misc:NOUNS:SECONDS:2"), interaction.translate("misc:NOUNS:SECONDS:5"))}` + time: `**${time}** ${client.getNoun(time, interaction.translate("misc:NOUNS:SECONDS:1"), interaction.translate("misc:NOUNS:SECONDS:2"), interaction.translate("misc:NOUNS:SECONDS:5"))}`, }); } } diff --git a/commands/Music/shuffle.js b/commands/Music/shuffle.js index 36eb9a23..19cf207f 100644 --- a/commands/Music/shuffle.js +++ b/commands/Music/shuffle.js @@ -14,7 +14,7 @@ class Shuffle extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** diff --git a/commands/Music/skip.js b/commands/Music/skip.js index e35644fd..5da884e1 100644 --- a/commands/Music/skip.js +++ b/commands/Music/skip.js @@ -14,7 +14,7 @@ class Skip extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** diff --git a/commands/Music/skipto.js b/commands/Music/skipto.js index 6e02f341..74b9b2a7 100644 --- a/commands/Music/skipto.js +++ b/commands/Music/skipto.js @@ -17,7 +17,7 @@ class Skipto extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -46,7 +46,7 @@ class Skipto extends BaseCommand { queue.skipTo(queue.tracks[position - 1]); interaction.success("music/skipto:SUCCESS", { - position: position + position: position, }); } else return interaction.error("music/skipto:ERROR", { position: position }); } diff --git a/commands/Music/stop.js b/commands/Music/stop.js index 7d259226..8ae602e3 100644 --- a/commands/Music/stop.js +++ b/commands/Music/stop.js @@ -14,7 +14,7 @@ class Stop extends BaseCommand { .setDMPermission(false), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** diff --git a/commands/NSFW/nsfw.js b/commands/NSFW/nsfw.js index 40f14942..8c1194d3 100644 --- a/commands/NSFW/nsfw.js +++ b/commands/NSFW/nsfw.js @@ -15,7 +15,7 @@ class NSFW extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: false + ownerOnly: false, }); } /** @@ -39,8 +39,8 @@ class NSFW extends BaseCommand { const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag => JSON.parse(JSON.stringify({ label: tag, - value: tag - })) + value: tag, + })), ); const row = new ActionRowBuilder() @@ -48,14 +48,14 @@ class NSFW extends BaseCommand { new SelectMenuBuilder() .setCustomId("nsfw_select") .setPlaceholder(client.translate("common:NOTHING_SELECTED")) - .addOptions(tags) + .addOptions(tags), ); const msg = await interaction.editReply({ content: interaction.translate("common:AVAILABLE_OPTIONS"), ephemeral: true, fetchReply: true, - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -71,7 +71,7 @@ class NSFW extends BaseCommand { const embed = new EmbedBuilder() .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setTitle(res.title) .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`) @@ -79,14 +79,14 @@ class NSFW extends BaseCommand { .setTimestamp(); await interaction.editReply({ - embeds: [embed] + embeds: [embed], }); } }); collector.on("end", () => { return interaction.editReply({ - components: [] + components: [], }); }); } diff --git a/commands/Owner/announcement.js b/commands/Owner/announcement.js index b280926a..76afb569 100644 --- a/commands/Owner/announcement.js +++ b/commands/Owner/announcement.js @@ -20,7 +20,7 @@ class Announcement extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: true + ownerOnly: true, }); } /** @@ -43,12 +43,12 @@ class Announcement extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ - name: interaction.translate("owner/announcement:TITLE") + name: interaction.translate("owner/announcement:TITLE"), }) .setDescription(text) .setColor(client.config.embed.color) .setFooter({ - text: interaction.user.tag + text: interaction.user.tag, }) .setTimestamp(); @@ -57,13 +57,13 @@ class Announcement extends BaseCommand { const channel = guild.channels.cache.get(guild?.data.plugins.news); await channel.send({ content: `${interaction.options.getBoolean("tag") ? "||@everyone|| " : ""}ВАЖНОЕ ОБЪЯВЛЕНИЕ!`, - embeds: [embed] + embeds: [embed], }); }); interaction.editReply({ content: interaction.translate("owner/announcement:SENDED"), - ephemeral: true + ephemeral: true, }); } } diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js index 1dab6793..748be66b 100644 --- a/commands/Owner/debug.js +++ b/commands/Owner/debug.js @@ -22,14 +22,14 @@ class Debug extends BaseCommand { { name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("economy/transactions:BANK"), value: "bank" }, - { name: client.translate("common:REP"), value: "rep" } + { name: client.translate("common:REP"), value: "rep" }, )) .addUserOption(option => option.setName("user") .setDescription(client.translate("common:USER")) .setRequired(true)) .addIntegerOption(option => option.setName("int") .setDescription(client.translate("common:INT")) - .setRequired(true)) + .setRequired(true)), ) .addSubcommand(subcommand => subcommand.setName("add") .setDescription(client.translate("owner/debug:ADD")) @@ -41,18 +41,18 @@ class Debug extends BaseCommand { { name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("economy/transactions:BANK"), value: "bank" }, - { name: client.translate("common:REP"), value: "rep" } + { name: client.translate("common:REP"), value: "rep" }, )) .addUserOption(option => option.setName("user") .setDescription(client.translate("common:USER")) .setRequired(true)) .addIntegerOption(option => option.setName("int") .setDescription(client.translate("owner/debug:INT")) - .setRequired(true)) + .setRequired(true)), ), aliases: [], dirname: __dirname, - ownerOnly: true + ownerOnly: true, }); } /** @@ -76,11 +76,11 @@ class Debug extends BaseCommand { const member = interaction.options.getMember("user"); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); const userData = await client.findOrCreateUser({ - id: member.id + id: member.id, }); const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); const int = interaction.options.getInteger("int"); @@ -90,7 +90,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -99,7 +99,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -108,7 +108,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -117,7 +117,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -126,7 +126,7 @@ class Debug extends BaseCommand { await userData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } } @@ -135,11 +135,11 @@ class Debug extends BaseCommand { const member = interaction.options.getMember("target"); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); const userData = await client.findOrCreateUser({ - id: member.id + id: member.id, }); const memberData = await client.findOrCreateMember({ id: member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); const int = interaction.options.getInteger("int"); @@ -149,7 +149,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -158,7 +158,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -167,7 +167,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -176,7 +176,7 @@ class Debug extends BaseCommand { await memberData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } @@ -185,7 +185,7 @@ class Debug extends BaseCommand { await userData.save(); return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { username: member.toString(), - amount: int + amount: int, }, { ephemeral: true }); } } diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index da18b8f3..600a9ce4 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -17,7 +17,7 @@ class Eval extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: true + ownerOnly: true, }); } /** @@ -45,7 +45,7 @@ class Eval extends BaseCommand { if (output.includes(client.token)) output = output.replace(client.token, "T0K3N"); interaction.editReply({ - content: "```js\n" + output + "```" + content: "```js\n" + output + "```", }); }).catch(err => { console.error(err); @@ -53,7 +53,7 @@ class Eval extends BaseCommand { if (err.includes(client.token)) err = err.replace(client.token, "T0K3N"); interaction.editReply({ - content: "```js\n" + err + "```" + content: "```js\n" + err + "```", }); }); } diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js index 5eed9d2b..09e83133 100644 --- a/commands/Owner/reload.js +++ b/commands/Owner/reload.js @@ -19,7 +19,7 @@ class Reload extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - ownerOnly: true + ownerOnly: true, }); } /** @@ -47,7 +47,7 @@ class Reload extends BaseCommand { autoUpdateDocs.update(client); interaction.success("owner/reload:SUCCESS", { - command: cmd.command.name + command: cmd.command.name, }, { ephemeral: true }); } } diff --git a/commands/Owner/say.js b/commands/Owner/say.js index 98faefc0..92b5fad4 100644 --- a/commands/Owner/say.js +++ b/commands/Owner/say.js @@ -19,7 +19,7 @@ class Say extends BaseCommand { .setDescription(client.translate("common:CHANNEL"))), aliases: [], dirname: __dirname, - ownerOnly: true + ownerOnly: true, }); } /** @@ -45,12 +45,12 @@ class Say extends BaseCommand { setTimeout(function () { interaction.channel.send({ - content: message + content: message, }); interaction.replyT("owner/say:DONE", { message, - channel: interaction.channel.toString() + channel: interaction.channel.toString(), }, { edit: true }); }, 2000); } else { @@ -58,12 +58,12 @@ class Say extends BaseCommand { setTimeout(function () { channel.send({ - content: message + content: message, }); interaction.replyT("owner/say:DONE", { message, - channel: channel.toString() + channel: channel.toString(), }, { edit: true }); }, 2000); } diff --git a/commands/Owner/servers.js b/commands/Owner/servers.js index d0cf53f4..ecc695e9 100644 --- a/commands/Owner/servers.js +++ b/commands/Owner/servers.js @@ -14,7 +14,7 @@ class Servers extends BaseCommand { .setDMPermission(true), aliases: [], dirname: __dirname, - ownerOnly: true + ownerOnly: true, }); } /** @@ -59,7 +59,7 @@ class Servers extends BaseCommand { await interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); const filter = i => i.user.id === interaction.user.id; @@ -75,7 +75,7 @@ class Servers extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); } } else if (i.customId === "servers_next_page") { @@ -86,7 +86,7 @@ class Servers extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); } } else if (i.customId === "servers_jump_page") { @@ -94,9 +94,9 @@ class Servers extends BaseCommand { const msg = await interaction.followUp({ content: interaction.translate("misc:JUMP_TO_PAGE", { - length: embeds.length + length: embeds.length, }), - fetchReply: true + fetchReply: true, }); const filter = res => { @@ -109,7 +109,7 @@ class Servers extends BaseCommand { interaction.editReply({ content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, embeds: [embeds[currentPage]], - components: [row] + components: [row], }); if (collected.first().deletable) collected.first().delete(); @@ -133,7 +133,7 @@ class Servers extends BaseCommand { }); return interaction.editReply({ - components: [row] + components: [row], }); }); } @@ -159,7 +159,7 @@ function generateServersEmbeds(interaction, servers) { const embed = new EmbedBuilder() .setColor(interaction.client.config.embed.color) .setFooter({ - text: interaction.client.config.embed.footer + text: interaction.client.config.embed.footer, }) .setTitle(interaction.translate("owner/servers:SERVERS_LIST")) .setDescription(info) diff --git a/config.sample.js b/config.sample.js index 72d654f4..370e9225 100644 --- a/config.sample.js +++ b/config.sample.js @@ -18,20 +18,20 @@ module.exports = { logs: "XXXXXXXXXXX", // The channel ID of logs port: 8080, // Dashboard port expressSessionPassword: "XXXXXXXXXXX", // Express session password (it can be what you want) - failureURL: "https://dashboard.example.com" // url on which users will be redirected if they click the cancel button (discord authentication) + failureURL: "https://dashboard.example.com", // url on which users will be redirected if they click the cancel button (discord authentication) }, mongoDB: "mongodb://localhost:27017/discordbot", // The URl of the mongodb database /* For the embeds (embeded messages) */ embed: { color: "#0091fc", // The default color for the embeds - footer: "Bot | v1.0" // And the default footer for the embeds + footer: "Bot | v1.0", // And the default footer for the embeds }, /* Bot's owner informations */ owner: { id: "XXXXXXXXXXX", // The ID of the bot's owner - name: "XXXXXXXXXXX#1234" // And the name of the bot's owner + name: "XXXXXXXXXXX#1234", // And the name of the bot's owner }, /* The API keys that are required for certain commands */ /* Not used right now */ - apiKeys: {} + apiKeys: {}, }; \ No newline at end of file diff --git a/dashboard/app.js b/dashboard/app.js index 00d69972..b58b403b 100644 --- a/dashboard/app.js +++ b/dashboard/app.js @@ -60,7 +60,7 @@ module.exports.init = async(client) => { res.status(404).render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}` + currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}`, }); }) .use(CheckAuth, function(err, req, res) { @@ -70,7 +70,7 @@ module.exports.init = async(client) => { res.status(500).render("500", { user: req.userInfos, translate: req.translate, - currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}` + currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}`, }); }); diff --git a/dashboard/routes/discord.js b/dashboard/routes/discord.js index 3d5f606d..15155b0b 100644 --- a/dashboard/routes/discord.js +++ b/dashboard/routes/discord.js @@ -14,14 +14,13 @@ router.get("/login", async function(req, res) { router.get("/callback", async (req, res) => { if (!req.query.code) return res.redirect(req.client.config.dashboard.failureURL); - if (req.query.state && req.query.state.startsWith("invite")) { + if (req.query.state && req.query.state.startsWith("invite")) if (req.query.code) { const guildID = req.query.state.substr("invite".length, req.query.state.length); req.client.knownGuilds.push({ id: guildID, user: req.user.id }); return res.redirect(`/manage/${guildID}`); } - } const redirectURL = req.client.states[req.query.state] || "/selector"; const params = new URLSearchParams(); @@ -33,8 +32,8 @@ router.get("/callback", async (req, res) => { body: params.toString(), headers: { Authorization: `Basic ${btoa(`${req.client.user.id}:${req.client.config.dashboard.secret}`)}`, - "Content-Type": "application/x-www-form-urlencoded" - } + "Content-Type": "application/x-www-form-urlencoded", + }, }); // Fetch tokens (used to fetch user informations) @@ -44,14 +43,14 @@ router.get("/callback", async (req, res) => { if (tokens.error || !tokens.access_token) return res.redirect(`/api/login&state=${req.query.state}`); const userData = { infos: null, - guilds: null + guilds: null, }; while (!userData.infos || !userData.guilds) { /* User infos */ if (!userData.infos) { response = await fetch("http://discordapp.com/api/users/@me", { method: "GET", - headers: { Authorization: `Bearer ${tokens.access_token}` } + headers: { Authorization: `Bearer ${tokens.access_token}` }, }); const json = await response.json(); if (json.retry_after) await req.client.wait(json.retry_after); @@ -62,7 +61,7 @@ router.get("/callback", async (req, res) => { if (!userData.guilds) { response = await fetch("https://discordapp.com/api/users/@me/guilds", { method: "GET", - headers: { Authorization: `Bearer ${tokens.access_token}` } + headers: { Authorization: `Bearer ${tokens.access_token}` }, }); const json = await response.json(); if (json.retry_after) await req.client.wait(json.retry_after); diff --git a/dashboard/routes/docs.js b/dashboard/routes/docs.js index a5bf3bb0..91b7d4f8 100644 --- a/dashboard/routes/docs.js +++ b/dashboard/routes/docs.js @@ -6,7 +6,7 @@ router.get("/", function (req, res) { user: req.userInfos, translate: req.translate, currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, - site: req.client.config.dashboard.baseURL + site: req.client.config.dashboard.baseURL, }); }); diff --git a/dashboard/routes/guild-manager.js b/dashboard/routes/guild-manager.js index 3156b0d2..e86a915d 100644 --- a/dashboard/routes/guild-manager.js +++ b/dashboard/routes/guild-manager.js @@ -7,13 +7,12 @@ const express = require("express"), router.get("/:serverID", CheckAuth, async(req, res) => { // Check if the user has the permissions to edit this guild const guild = req.client.guilds.cache.get(req.params.serverID); - if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) { + if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) return res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); - } // Fetch guild informations const guildInfos = await utils.fetchGuild(guild.id, req.client, req.user.guilds); @@ -26,20 +25,19 @@ router.get("/:serverID", CheckAuth, async(req, res) => { translate: req.translate, ChannelType, bot: req.client, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); }); router.post("/:serverID", CheckAuth, async(req, res) => { // Check if the user has the permissions to edit this guild const guild = req.client.guilds.cache.get(req.params.serverID); - if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) { + if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) return res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); - } const guildData = await req.client.findOrCreateGuild({ id: guild.id }); const data = req.body; @@ -57,7 +55,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { enabled: true, message: data.message, channel: guild.channels.cache.find(ch => "#" + ch.name === data.channel).id, - withImage: data.withImage === "on" + withImage: data.withImage === "on", }; guildData.plugins.welcome = welcome; guildData.markModified("plugins.welcome"); @@ -69,7 +67,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { enabled: false, message: null, channel: null, - withImage: null + withImage: null, }; guildData.plugins.welcome = welcome; guildData.markModified("plugins.welcome"); @@ -81,7 +79,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { enabled: true, message: data.message, channel: guild.channels.cache.find(ch => "#" + ch.name === data.channel).id, - withImage: data.withImage === "on" + withImage: data.withImage === "on", }; guildData.plugins.goodbye = goodbye; guildData.markModified("plugins.goodbye"); @@ -93,7 +91,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { enabled: false, message: null, channel: null, - withImage: null + withImage: null, }; guildData.plugins.goodbye = goodbye; guildData.markModified("plugins.goodbye"); @@ -103,7 +101,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { if (Object.prototype.hasOwnProperty.call(data, "autoroleEnable") || Object.prototype.hasOwnProperty.call(data, "autoroleUpdate")) { const autorole = { enabled: true, - role: guild.roles.cache.find(r => "@" + r.name === data.role).id + role: guild.roles.cache.find(r => "@" + r.name === data.role).id, }; guildData.plugins.autorole = autorole; guildData.markModified("plugins.autorole"); @@ -113,7 +111,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { if (Object.prototype.hasOwnProperty.call(data, "autoroleDisable")) { const autorole = { enabled: false, - role: null + role: null, }; guildData.plugins.autorole = autorole; guildData.markModified("plugins.autorole"); diff --git a/dashboard/routes/guild-stats.js b/dashboard/routes/guild-stats.js index f6c7b458..6590d670 100644 --- a/dashboard/routes/guild-stats.js +++ b/dashboard/routes/guild-stats.js @@ -6,30 +6,29 @@ const express = require("express"), router.get("/:serverID", CheckAuth, async (req, res) => { // Check if the user has the permissions to edit this guild const guild = req.client.guilds.cache.get(req.params.serverID); - if (!guild) { + if (!guild) return res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); - } const memberData = await req.client.findOrCreateMember({ id: req.userInfos.id, guildId: guild.id }); // Fetch guild informations const membersData = await req.client.membersData.find({ - guildID: guild.id + guildID: guild.id, }).lean(), members = membersData.map((m) => { return { id: m.id, - money: m.money + m.bankSold + money: m.money + m.bankSold, }; }).sort((a, b) => b.money - a.money); const leaderboards = { money: members, - level: utils.sortArrayOfObjects("level", membersData) + level: utils.sortArrayOfObjects("level", membersData), }; for (const cat in leaderboards) { @@ -39,7 +38,7 @@ router.get("/:serverID", CheckAuth, async (req, res) => { const stats = { money: await utils.fetchUsers(leaderboards.money, req.client), - level: await utils.fetchUsers(leaderboards.level, req.client) + level: await utils.fetchUsers(leaderboards.level, req.client), }; res.render("stats/guild", { diff --git a/dashboard/routes/index.js b/dashboard/routes/index.js index 0b1a60e4..edd13fb0 100644 --- a/dashboard/routes/index.js +++ b/dashboard/routes/index.js @@ -10,7 +10,7 @@ router.get("/selector", CheckAuth, async(req, res) => { res.render("selector", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); }); diff --git a/dashboard/routes/profile.js b/dashboard/routes/profile.js index 8420c0e4..c57dc797 100644 --- a/dashboard/routes/profile.js +++ b/dashboard/routes/profile.js @@ -9,7 +9,7 @@ router.get("/", CheckAuth, async function(req, res) { bot: req.client, translate: req.translate, printDate: req.printDate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); }); @@ -18,12 +18,11 @@ router.post("/", CheckAuth, async function(req, res) { const data = req.body; if (data.bio) user.bio = data.bio; - if (data.birthdate) { + if (data.birthdate) if (checkDate(data.birthdate)) { user.birthdate = checkDate(data.birthdate); user.markModified("birthdate"); } - } await user.save(); res.redirect(303, "/profile"); @@ -39,8 +38,9 @@ function checkDate(birthdate) { if (!day || !month || !year) return false; const match = birthdate.match(/\d+/g); if (!match) return false; - const tday = + match[0], tmonth = + match[1] - 1; - let tyear = + match[2]; + 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 false; diff --git a/dashboard/routes/user.js b/dashboard/routes/user.js index 001606f7..4ad5ca83 100644 --- a/dashboard/routes/user.js +++ b/dashboard/routes/user.js @@ -6,22 +6,22 @@ const express = require("express"), // Gets user page router.get("/:userID/:serverID", CheckAuth, async function (req, res) { const guild = req.client.guilds.cache.get(req.params.serverID); - if (!guild) { + if (!guild) return res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); - } + const guildData = await req.client.findOrCreateGuild({ id: guild.id }); const userInfos = await utils.fetchUser({ - id: req.params.userID + id: req.params.userID, }, req.client).catch(() => { res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); }); @@ -32,7 +32,7 @@ router.get("/:userID/:serverID", CheckAuth, async function (req, res) { bot: req.client, translate: req.translate, printDate: req.printDate, - currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); }); diff --git a/dashboard/utils.js b/dashboard/utils.js index 432b5d5f..a47241cb 100644 --- a/dashboard/utils.js +++ b/dashboard/utils.js @@ -25,13 +25,13 @@ async function fetchUser(userData, client, query) { const user = await client.users.fetch(userData.id); const userDb = await client.findOrCreateUser({ - id: user.id + id: user.id, }, true); const userInfos = { ...user.toJSON(), ...userDb, - ...userData + ...userData, }; return userInfos; @@ -54,9 +54,9 @@ async function fetchUsers(array, client) { ...{ money: element.money, level: element.level, - rep: element.rep + rep: element.rep, }, - ...user.toJSON() + ...user.toJSON(), }); }); }); @@ -74,13 +74,13 @@ async function fetchUsers(array, client) { async function fetchGuild(guildID, client, guilds) { const guild = client.guilds.cache.get(guildID); const conf = await client.findOrCreateGuild({ - id: guild.id + id: guild.id, }); return { ...guild, ...conf.toJSON(), - ...guilds.find((g) => g.id === guild.id) + ...guilds.find((g) => g.id === guild.id), }; } diff --git a/events/CommandHandler.js b/events/CommandHandler.js index 24661c33..98132f6a 100644 --- a/events/CommandHandler.js +++ b/events/CommandHandler.js @@ -5,7 +5,7 @@ class CommandHandler extends BaseEvent { constructor() { super({ name: "interactionCreate", - once: false + once: false, }); } @@ -21,7 +21,7 @@ class CommandHandler extends BaseEvent { const data = []; const userData = await client.findOrCreateUser({ - id: interaction.user.id + id: interaction.user.id, }); data.userData = userData; @@ -30,13 +30,13 @@ class CommandHandler extends BaseEvent { if (interaction.inGuild()) { const guildData = await client.findOrCreateGuild({ - id: interaction.guildId + id: interaction.guildId, }); interaction.guild.data = data.guildData = guildData; const memberData = await client.findOrCreateMember({ id: interaction.member.id, - guildId: interaction.guildId + guildId: interaction.guildId, }); data.memberData = memberData; } @@ -50,8 +50,8 @@ class CommandHandler extends BaseEvent { content: interaction.user.toString(), files: [{ name: "achievement_unlocked2.png", - attachment: "./assets/img/achievements/achievement_unlocked2.png" - }] + attachment: "./assets/img/achievements/achievement_unlocked2.png", + }], }); } diff --git a/events/Guild/guildCreate.js b/events/Guild/guildCreate.js index db003a53..b5238ab6 100644 --- a/events/Guild/guildCreate.js +++ b/events/Guild/guildCreate.js @@ -5,7 +5,7 @@ class GuildCreate extends BaseEvent { constructor() { super({ name: "guildCreate", - once: false + once: false, }); } @@ -18,7 +18,7 @@ class GuildCreate extends BaseEvent { const messageOptions = {}; const userData = await client.findOrCreateUser({ - id: guild.ownerId + id: guild.ownerId, }); if (!userData.achievements.invite.achieved) { @@ -26,7 +26,7 @@ class GuildCreate extends BaseEvent { userData.achievements.invite.achieved = true; messageOptions.files = [{ name: "unlocked.png", - attachment: "./assets/img/achievements/achievement_unlocked7.png" + attachment: "./assets/img/achievements/achievement_unlocked7.png", }]; userData.markModified("achievements.invite"); await userData.save(); @@ -34,12 +34,12 @@ class GuildCreate extends BaseEvent { const thanksEmbed = new EmbedBuilder() .setAuthor({ - name: "Спасибо что добавили меня на свой сервер!" + name: "Спасибо что добавили меня на свой сервер!", }) .setDescription("Чтобы получить список команд, используйте `/help`!.") .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .setTimestamp(); messageOptions.embeds = [thanksEmbed]; @@ -53,12 +53,12 @@ class GuildCreate extends BaseEvent { const embed = new EmbedBuilder() .setAuthor({ name: guild.name, - iconURL: guild.iconURL() + iconURL: guild.iconURL(), }) .setColor("#32CD32") .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`); client.channels.cache.get(client.config.support.logs).send({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/events/Guild/guildDelete.js b/events/Guild/guildDelete.js index 56a438b4..2aa52bea 100644 --- a/events/Guild/guildDelete.js +++ b/events/Guild/guildDelete.js @@ -5,7 +5,7 @@ class GuildDelete extends BaseEvent { constructor() { super({ name: "guildDelete", - once: false + once: false, }); } @@ -18,12 +18,12 @@ class GuildDelete extends BaseEvent { const embed = new EmbedBuilder() .setAuthor({ name: guild.name, - iconURL: guild.iconURL() + iconURL: guild.iconURL(), }) .setColor("#B22222") .setDescription(`Вышел с сервера **${guild.name}**.`); client.channels.cache.get(client.config.support.logs).send({ - embeds: [embed] + embeds: [embed], }); } } diff --git a/events/Guild/guildMemberAdd.js b/events/Guild/guildMemberAdd.js index 10c99121..84a89468 100644 --- a/events/Guild/guildMemberAdd.js +++ b/events/Guild/guildMemberAdd.js @@ -8,9 +8,8 @@ Canvas.registerFont(resolve("./assets/fonts/KeepCalm-Medium.ttf"), { family: "Ke const applyText = (canvas, text, defaultFontSize, width, font) => { const ctx = canvas.getContext("2d"); - do { - ctx.font = `${(defaultFontSize -= 1)}px ${font}`; - } while (ctx.measureText(text).width > width); + do ctx.font = `${(defaultFontSize -= 1)}px ${font}`; + while (ctx.measureText(text).width > width); return ctx.font; }; @@ -19,7 +18,7 @@ class GuildMemberAdd extends BaseEvent { constructor() { super({ name: "guildMemberAdd", - once: false + once: false, }); } @@ -34,23 +33,22 @@ class GuildMemberAdd extends BaseEvent { await member.guild.members.fetch(); const guildData = await client.findOrCreateGuild({ - id: member.guild.id + id: member.guild.id, }); member.guild.data = guildData; const memberData = await client.findOrCreateMember({ id: member.id, - guildId: member.guild.id + guildId: member.guild.id, }); - if (memberData.mute.muted && memberData.mute.endDate > Date.now()) { + if (memberData.mute.muted && memberData.mute.endDate > Date.now()) member.guild.channels.cache.forEach((channel) => { channel.permissionOverwrites.edit(member.id, { SEND_MESSAGES: false, ADD_REACTIONS: false, - CONNECT: false + CONNECT: false, }).catch(() => {}); }); - } if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role); @@ -94,11 +92,11 @@ class GuildMemberAdd extends BaseEvent { // Draw server name ctx.font = applyText(canvas, client.translate("administration/welcome:IMG_WELCOME", { - server: member.guild.name + server: member.guild.name, }, member.guild.data.language), 53, 625, "RubikMonoOne"); ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", { - server: member.guild.name + server: member.guild.name, }, member.guild.data.language), canvas.width - 700, canvas.height - 70); // Draw discriminator @@ -131,20 +129,16 @@ class GuildMemberAdd extends BaseEvent { ctx.closePath(); ctx.clip(); const avatar = await Canvas.loadImage(member.displayAvatarURL({ - extension: "jpg" + extension: "jpg", })); ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "welcome-image.png" }); channel.send({ content: message, - files: [attachment] + files: [attachment], }); - } else { - channel.send({ - content: message - }); - } + } else channel.send({ content: message }); } } } diff --git a/events/Guild/guildMemberRemove.js b/events/Guild/guildMemberRemove.js index 3ddb1f59..26f45838 100644 --- a/events/Guild/guildMemberRemove.js +++ b/events/Guild/guildMemberRemove.js @@ -3,14 +3,13 @@ const Canvas = require("canvas"), { AttachmentBuilder } = require("discord.js"), { resolve } = require("path"); -Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "RubikMonoOne" }); +Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "RubikMonoOne" }); Canvas.registerFont(resolve("./assets/fonts/KeepCalm-Medium.ttf"), { family: "KeepCalm" }); const applyText = (canvas, text, defaultFontSize, width, font) => { const ctx = canvas.getContext("2d"); - do { - ctx.font = `${(defaultFontSize -= 1)}px ${font}`; - } while (ctx.measureText(text).width > width); + do ctx.font = `${(defaultFontSize -= 1)}px ${font}`; + while (ctx.measureText(text).width > width); return ctx.font; }; @@ -19,7 +18,7 @@ class GuildMemberRemove extends BaseEvent { constructor() { super({ name: "guildMemberRemove", - once: false + once: false, }); } @@ -34,7 +33,7 @@ class GuildMemberRemove extends BaseEvent { await member.guild.members.fetch(); const guildData = await client.findOrCreateGuild({ - id: member.guild.id + id: member.guild.id, }); member.guild.data = guildData; @@ -78,11 +77,11 @@ class GuildMemberRemove extends BaseEvent { // Draw server name ctx.font = applyText(canvas, client.translate("administration/goodbye:IMG_GOODBYE", { - server: member.guild.name + server: member.guild.name, }, member.guild.data.language), 53, 625, "RubikMonoOne"); ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", { - server: member.guild.name + server: member.guild.name, }, member.guild.data.language), canvas.width - 700, canvas.height - 70); // Draw discriminator @@ -116,20 +115,16 @@ class GuildMemberRemove extends BaseEvent { ctx.clip(); const avatar = await Canvas.loadImage(member.displayAvatarURL({ extension: "png", - size: 512 + size: 512, })); ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "goodbye-image.png" }); channel.send({ content: message, - files: [attachment] + files: [attachment], }); - } else { - channel.send({ - content: message - }); - } + } else channel.send({ content: message }); } } } diff --git a/events/Guild/guildMemberUpdate.js b/events/Guild/guildMemberUpdate.js index 17649167..0f04b48a 100644 --- a/events/Guild/guildMemberUpdate.js +++ b/events/Guild/guildMemberUpdate.js @@ -4,7 +4,7 @@ class GuildMemberUpdate extends BaseEvent { constructor() { super({ name: "guildMemberRemove", - once: false + once: false, }); } @@ -21,7 +21,7 @@ class GuildMemberUpdate extends BaseEvent { if (newMember?.roles.cache.some(r => r.name === "Поддержавшие JaBa")) { const userData = await client.findOrCreateUser({ - id: newMember.id + id: newMember.id, }); userData.achievements.tip.progress.now = 1; userData.achievements.tip.achieved = true; @@ -31,8 +31,8 @@ class GuildMemberUpdate extends BaseEvent { newMember.send({ files: [{ name: "achievement_unlocked5.png", - attachment: "./assets/img/achievements/achievement_unlocked5.png" - }] + attachment: "./assets/img/achievements/achievement_unlocked5.png", + }], }); } } diff --git a/events/MessageHandler.js b/events/MessageHandler.js index cd22158f..50a3510d 100644 --- a/events/MessageHandler.js +++ b/events/MessageHandler.js @@ -6,7 +6,7 @@ class MessageCreate extends BaseEvent { constructor() { super({ name: "messageCreate", - once: false + once: false, }); } @@ -25,7 +25,7 @@ class MessageCreate extends BaseEvent { if (message.guild && !message.member) await message.guild.members.fetch(message.author.id); if (message.guild) { const guild = await client.findOrCreateGuild({ - id: message.guild.id + id: message.guild.id, }); message.guild.data = data.guildData = guild; } @@ -33,40 +33,38 @@ class MessageCreate extends BaseEvent { if (message.guild) { const memberData = await client.findOrCreateMember({ id: message.author.id, - guildId: message.guild.id + guildId: message.guild.id, }); data.memberData = memberData; } const userData = await client.findOrCreateUser({ - id: message.author.id + id: message.author.id, }); data.userData = userData; if (message.guild) { await updateXp(client, message, data); - if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id)) { - if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content)) { + if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id)) + if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content)) if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) { message.delete(); return message.error("administration/automod:DELETED"); } - } - } const afkReason = data.userData.afk; if (afkReason) { data.userData.afk = null; await data.userData.save(); message.replyT("general/afk:DELETED", { - username: message.author.username + username: message.author.username, }, { mention: true }); } message.mentions.users.forEach(async (u) => { const userData = await client.findOrCreateUser({ - id: u.id + id: u.id, }); if (userData.afk) message.error("general/afk:IS_AFK", { user: u.tag, reason: userData.afk }); }); @@ -87,9 +85,8 @@ async function updateXp(client, msg, data) { level = parseInt(data.memberData.level), isInCooldown = xpCooldown[msg.author.id]; - if (isInCooldown) { + if (isInCooldown) if (isInCooldown > Date.now()) return; - } const toWait = Date.now() + (60 * 1000); // 1 min xpCooldown[msg.author.id] = toWait; @@ -102,7 +99,7 @@ async function updateXp(client, msg, data) { data.memberData.level = parseInt(level + 1, 10); data.memberData.exp = 0; msg.replyT("misc:LEVEL_UP", { - level: data.memberData.level + level: data.memberData.level, }, { mention: false }); } else data.memberData.exp = parseInt(newXp, 10); diff --git a/events/ready.js b/events/ready.js index 4a8774bd..4bbf995a 100644 --- a/events/ready.js +++ b/events/ready.js @@ -5,7 +5,7 @@ class Ready extends BaseEvent { constructor() { super({ name: "ready", - once: false + once: false, }); } /** @@ -20,7 +20,7 @@ class Ready extends BaseEvent { client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready"); client.logger.log(`${client.user.tag}, ready to serve ${tUsers} users in ${tServers} servers.`, "ready"); - client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"] , permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready"); + client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready"); const birthdays = require("../helpers/birthdays"); birthdays.init(client); @@ -41,7 +41,7 @@ class Ready extends BaseEvent { { name: "help", type: ActivityType.Watching }, { name: `${commands.length} ${client.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: ActivityType.Listening }, { name: `${tServers} ${client.getNoun(tServers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: ActivityType.Watching }, - { name: `${tUsers} ${client.getNoun(tUsers, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: ActivityType.Watching } + { name: `${tUsers} ${client.getNoun(tUsers, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: ActivityType.Watching }, ]; let i = 0; @@ -52,7 +52,7 @@ class Ready extends BaseEvent { const toShow = status[i]; client.user.setActivity(`${toShow.name} | v${version}`, { - type: toShow.type + type: toShow.type, }); if (status[i + 1]) i++; diff --git a/helpers/autoUpdateDocs.js b/helpers/autoUpdateDocs.js index 69f993f6..35efffb4 100644 --- a/helpers/autoUpdateDocs.js +++ b/helpers/autoUpdateDocs.js @@ -25,7 +25,7 @@ module.exports.update = function (client) { categories.sort().forEach(cat => { const categoriesArray = [ - ["Название", "Описание", "Использование", "Разрешено использование"] + ["Название", "Описание", "Использование", "Разрешено использование"], ]; const cmds = [...new Map(commands.filter(cmd => cmd.category === cat).map(v => [v.constructor.name, v])).values()]; @@ -38,7 +38,7 @@ module.exports.update = function (client) { `**${cmd.command.name}** ${cmd.aliases.length ? `**(${cmd.aliases.join(", ")})**` : ""}`, client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`), `${cmd.command.name} ${client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`)}`, - cmd.guildOnly ? "Только на сервере" : "На сервере и в ЛС бота" + cmd.guildOnly ? "Только на сервере" : "На сервере и в ЛС бота", ]); }); text += `${table(categoriesArray)}\n\n`; diff --git a/helpers/birthdays.js b/helpers/birthdays.js index 4970f556..022d51d5 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -14,7 +14,7 @@ module.exports.init = async function (client) { client.guilds.cache.forEach(async guild => { const guildData = await client.findOrCreateGuild({ - id: guild.id + id: guild.id, }); if (guildData.plugins.birthdays) { @@ -36,12 +36,12 @@ module.exports.init = async function (client) { name: client.user.username, iconURL: client.user.displayAvatarURL({ extension: "png", - size: 512 - }) + size: 512, + }), }) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }) .addFields([ { @@ -49,13 +49,13 @@ module.exports.init = async function (client) { value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { name: user.username, user: user.id, - age: `**${age}** ${client.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}` - }) - } + age: `**${age}** ${client.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}`, + }), + }, ]); const msg = await channel.send({ - embeds: [embed] + embeds: [embed], }); await msg.react("🎉"); } diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 08370250..7614169a 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -28,23 +28,23 @@ module.exports.init = function (client) { mustSent.forEach(r => { const embed = new EmbedBuilder() .setAuthor({ - name: client.translate("general/remindme:TITLE") + name: client.translate("general/remindme:TITLE"), }) .setDescription(client.translate("general/remindme:CREATED", { - time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss") + time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss"), })) .addFields([ { name: client.translate("common:MESSAGE"), - value: r.message - } + value: r.message, + }, ]) .setColor(client.config.embed.color) .setFooter({ - text: client.config.embed.footer + text: client.config.embed.footer, }); dUser.send({ - embeds: [embed] + embeds: [embed], }); }); user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); diff --git a/helpers/checkUnmutes.js b/helpers/checkUnmutes.js index 18a40bc3..01d8f56f 100644 --- a/helpers/checkUnmutes.js +++ b/helpers/checkUnmutes.js @@ -20,7 +20,7 @@ module.exports.init = async function (client) { memberData.mute = { muted: false, endDate: null, - case: null + case: null, }; memberData.save(); client.logger.log("[Unmuted] " + memberData.id + " cannot be found."); @@ -28,7 +28,7 @@ module.exports.init = async function (client) { }); const guildData = await client.findOrCreateGuild({ - id: guild.id + id: guild.id, }); if (member) { @@ -43,11 +43,11 @@ module.exports.init = async function (client) { .setDescription(guild.translate("moderation/unmute:SUCCESS_CASE", { user: user.toString(), usertag: user.tag, - count: memberData.mute.case + count: memberData.mute.case, })) .setColor("#F44271") .setFooter({ - text: guild.client.config.embed.footer + text: guild.client.config.embed.footer, }); const channel = guild.channels.cache.get(guildData.plugins.modlogs); @@ -56,7 +56,7 @@ module.exports.init = async function (client) { memberData.mute = { muted: false, endDate: null, - case: null + case: null, }; client.databaseCache.mutedUsers.delete(`${memberData.id}${memberData.guildID}`); diff --git a/helpers/discordTogether.js b/helpers/discordTogether.js index 134b6259..a52cc329 100644 --- a/helpers/discordTogether.js +++ b/helpers/discordTogether.js @@ -100,7 +100,7 @@ class DiscordTogether { max_uses: 0, temporary: false, target_type: 2, - target_application_id: applicationID + target_application_id: applicationID, }), headers: { Authorization: `Bot ${this.client.config.token}`, diff --git a/helpers/functions.js b/helpers/functions.js index c6e0d95a..399b1be2 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -31,7 +31,7 @@ module.exports = { temporaryValue, randomIndex; // While there remain elements to shuffle... - while (0 !== currentIndex) { + while (currentIndex !== 0) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; @@ -46,5 +46,5 @@ module.exports = { randomNum(min, max) { return Math.floor(Math.random() * (max - min) + min + 1); - } + }, }; \ No newline at end of file diff --git a/helpers/languages.js b/helpers/languages.js index 912b34eb..235f94a5 100644 --- a/helpers/languages.js +++ b/helpers/languages.js @@ -23,14 +23,14 @@ async function walkDirectory(dir, namespaces = [], folderName = "") { return { namespaces: [...new Set(namespaces)], - languages + languages, }; } module.exports = async () => { const options = { jsonIndent: 2, - loadPath: path.resolve(__dirname, "../languages/{{lng}}/{{ns}}.json") + loadPath: path.resolve(__dirname, "../languages/{{lng}}/{{ns}}.json"), }; const { namespaces, languages } = await walkDirectory(path.resolve(__dirname, "../languages/")); @@ -45,7 +45,7 @@ module.exports = async () => { interpolation: { escapeValue: false }, load: "all", ns: namespaces, - preload: languages + preload: languages, }); return new Map(languages.map(item => [item, i18next.getFixedT(item)])); diff --git a/helpers/mee6-api.js b/helpers/mee6-api.js index ee522a6a..ae221a95 100644 --- a/helpers/mee6-api.js +++ b/helpers/mee6-api.js @@ -9,6 +9,7 @@ const fetchMee6 = async args => { if (response.error && response.error.message) throw new Error(`${response.statusCode}: ${response.error.message}`); else throw new Error(`${response.statusCode}: ${response.statusMessage}`); } + return response; }; @@ -55,7 +56,7 @@ class Mee6Api { id, level, username, discriminator, avatarUrl, messageCount, tag: `${username}#${discriminator}`, xp: { userXp, levelXp, totalXp }, - rank: (limit * page) + index + 1 + rank: (limit * page) + index + 1, }; }); } diff --git a/helpers/tictactoe.js b/helpers/tictactoe.js index 6b562efa..5ac7b37c 100644 --- a/helpers/tictactoe.js +++ b/helpers/tictactoe.js @@ -30,37 +30,37 @@ async function tictactoe(interaction, options = {}) { if (!opponent) return interaction.reply({ content: interaction.translate("economy/tictactoe:NO_USER"), - ephemeral: true + ephemeral: true, }); if (opponent.bot) return interaction.reply({ content: interaction.translate("economy/tictactoe:BOT_USER"), - ephemeral: true + ephemeral: true, }); if (opponent.id == (interaction.user ? interaction.user : interaction.author).id) return interaction.reply({ content: interaction.translate("economy/tictactoe:YOURSELF"), - ephemeral: true + ephemeral: true, }); } else if (!interaction.commandId) { opponent = interaction.mentions.members.first()?.user; if (!opponent) return interaction.reply({ - content: interaction.translate("economy/tictactoe:NO_USER") + content: interaction.translate("economy/tictactoe:NO_USER"), }); if (opponent.bot) return interaction.reply({ content: interaction.translate("economy/tictactoe:BOT_USER"), - ephemeral: true + ephemeral: true, }); if (opponent.id === interaction.member.id) return interaction.reply({ - content: interaction.translate("economy/tictactoe:YOURSELF") + content: interaction.translate("economy/tictactoe:YOURSELF"), }); } @@ -68,11 +68,11 @@ async function tictactoe(interaction, options = {}) { const acceptEmbed = new EmbedBuilder() .setTitle(interaction.translate("economy/tictactoe:REQUEST_WAIT", { - user: opponent.id + user: opponent.id, })) .setAuthor({ name: (interaction.user ? interaction.user : interaction.author).tag, - iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL() + iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL(), }) .setColor(options.embedColor || "#075FFF") .setFooter(foot) @@ -90,38 +90,35 @@ async function tictactoe(interaction, options = {}) { const accep = new ActionRowBuilder().addComponents([ accept, - decline + decline, ]); let m; - if (interaction.commandId) { - m = await interaction.reply({ - content: interaction.translate("economy/tictactoe:INVITE_USER", { - opponent: opponent.id - }), - embeds: [acceptEmbed], - components: [accep] - }); - } else if (!interaction.commandId) { - m = await interaction.reply({ - content: interaction.translate("economy/tictactoe:INVITE_USER", { - opponent: opponent.id - }), - embeds: [acceptEmbed], - components: [accep] - }); - } + if (interaction.commandId) m = await interaction.reply({ + content: interaction.translate("economy/tictactoe:INVITE_USER", { + opponent: opponent.id, + }), + embeds: [acceptEmbed], + components: [accep], + }); else if (!interaction.commandId) m = await interaction.reply({ + content: interaction.translate("economy/tictactoe:INVITE_USER", { + opponent: opponent.id, + }), + embeds: [acceptEmbed], + components: [accep], + }); + const collector = m.createMessageComponentCollector({ componentType: ComponentType.Button, - time: 5000 + time: 5000, }); collector.on("collect", async button => { if (button.user.id !== opponent.id) return button.reply({ content: interaction.translate("economy/tictactoe:REQUEST_SEND", { - opponent: opponent.id + opponent: opponent.id, }), - ephemeral: true + ephemeral: true, }); if (button.customId == "declinettt") { @@ -133,7 +130,7 @@ async function tictactoe(interaction, options = {}) { const fighters = [ (interaction.user ? interaction.user : interaction.author).id, - opponent.id + opponent.id, ].sort(() => (Math.random() > 0.5 ? 1 : -1)); const x_emoji = options.xEmoji || "❌"; @@ -146,50 +143,49 @@ async function tictactoe(interaction, options = {}) { a1: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, a2: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, a3: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, b1: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, b2: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, b3: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, c1: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, c2: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false + disabled: false, }, c3: { style: ButtonStyle.Secondary, emoji: dashmoji, - disabled: false - } + disabled: false, + }, }; - const { ActionRowBuilder, ButtonBuilder } = require("discord.js"); const epm = new EmbedBuilder() .setTitle(interaction.translate("economy/tictactoe:DESCRIPTION")) @@ -198,29 +194,25 @@ async function tictactoe(interaction, options = {}) { .setTimestamp(); let msg; - if (interaction.commandId) { - msg = await interaction.editReply({ - embeds: [ - epm.setDescription( - interaction.translate("economy/tictactoe:WAITING", { - user: Args.userid, - emoji: client.emojis.cache.get(o_emoji) || "⭕" - }) - ) - ] - }); - } else if (!interaction.commandId) { - msg = await button.message.edit({ - embeds: [ - epm.setDescription( - interaction.translate("economy/tictactoe:WAITING", { - user: Args.userid, - emoji: client.emojis.cache.get(o_emoji) || "⭕" - }) - ) - ] - }); - } + if (interaction.commandId) msg = await interaction.editReply({ + embeds: [ + epm.setDescription( + interaction.translate("economy/tictactoe:WAITING", { + user: Args.userid, + emoji: client.emojis.cache.get(o_emoji) || "⭕", + }), + ), + ], + }); else if (!interaction.commandId) msg = await button.message.edit({ + embeds: [ + epm.setDescription( + interaction.translate("economy/tictactoe:WAITING", { + user: Args.userid, + emoji: client.emojis.cache.get(o_emoji) || "⭕", + }), + ), + ], + }); await ttt(msg); @@ -229,7 +221,7 @@ async function tictactoe(interaction, options = {}) { Args.userid = fighters[Args.user]; const won = { "<:O_:863314110560993340>": false, - "<:X_:863314044781723668>": false + "<:X_:863314044781723668>": false, }; const a1 = new ButtonBuilder() @@ -286,51 +278,51 @@ async function tictactoe(interaction, options = {}) { Args.a1.emoji == o_emoji && Args.b1.emoji == o_emoji && Args.c1.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.a2.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c2.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.a3.emoji == o_emoji && Args.b3.emoji == o_emoji && Args.c3.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.a1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c3.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.a3.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c1.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.a1.emoji == o_emoji && Args.a2.emoji == o_emoji && Args.a3.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.b1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.b3.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; + ) won["<:O_:863314110560993340>"] = true; + if ( Args.c1.emoji == o_emoji && Args.c2.emoji == o_emoji && Args.c3.emoji == o_emoji - ) - won["<:O_:863314110560993340>"] = true; - if (won["<:O_:863314110560993340>"] != false) { + ) won["<:O_:863314110560993340>"] = true; + + if (won["<:O_:863314110560993340>"] != false) if (Args.user == 0) { const wonner = await client.users .fetch(fighters[1]) @@ -342,7 +334,7 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), components: buttons, @@ -350,10 +342,10 @@ async function tictactoe(interaction, options = {}) { epm.setDescription( interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" - }) - ) - ] + emoji: client.emojis.cache.get(o_emoji) || "⭕", + }), + ), + ], }) .then(m => { m.react("⭕"); @@ -363,14 +355,14 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), embeds: [ epm.setDescription( `${interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", })}\n\`\`\`\n${Args.a1.emoji .replace(o_emoji, "⭕") .replace(x_emoji, "❌")} | ${Args.a2.emoji @@ -391,11 +383,11 @@ async function tictactoe(interaction, options = {}) { .replace(o_emoji, "⭕") .replace(x_emoji, "❌")}\n\`\`\``.replaceAll( dashmoji, - "➖" - ) - ) + "➖", + ), + ), ], - components: [] + components: [], }) .then(m => { m.react("⭕"); @@ -411,17 +403,17 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), components: buttons, embeds: [ epm.setDescription( interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" - }) - ) - ] + emoji: client.emojis.cache.get(o_emoji) || "⭕", + }), + ), + ], }) .then(m => { m.react("⭕"); @@ -431,14 +423,14 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), embeds: [ epm.setDescription( `${interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", })}\n\`\`\`\n${Args.a1.emoji .replace(o_emoji, "⭕") .replace(x_emoji, "❌")} | ${Args.a2.emoji @@ -459,17 +451,17 @@ async function tictactoe(interaction, options = {}) { .replace(o_emoji, "⭕") .replace(x_emoji, "❌")}\n\`\`\``.replaceAll( dashmoji, - "➖" - ) - ) + "➖", + ), + ), ], - components: [] + components: [], }) .then(m => { m.react("⭕"); }); } - } + if ( Args.a1.emoji == x_emoji && Args.b1.emoji == x_emoji && @@ -518,7 +510,7 @@ async function tictactoe(interaction, options = {}) { Args.c3.emoji == x_emoji ) won["<:X_:863314044781723668>"] = true; - if (won["<:X_:863314044781723668>"] != false) { + if (won["<:X_:863314044781723668>"] != false) if (Args.user == 0) { const wonner = await client.users .fetch(fighters[1]) @@ -530,17 +522,17 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), components: buttons, embeds: [ epm.setDescription( interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" - }) - ) - ] + emoji: client.emojis.cache.get(o_emoji) || "⭕", + }), + ), + ], }) .then(m => { m.react("❌"); @@ -550,13 +542,13 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), embeds: [ epm.setDescription( `${interaction.translate("economy/tictactoe:WON", { winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", })}\n\`\`\`\n${Args.a1.emoji .replace(o_emoji, "⭕") .replace(x_emoji, "❌")} | ${Args.a2.emoji @@ -577,11 +569,11 @@ async function tictactoe(interaction, options = {}) { .replace(o_emoji, "⭕") .replace(x_emoji, "❌")}\n\`\`\``.replaceAll( dashmoji, - "➖" - ) - ) + "➖", + ), + ), ], - components: [] + components: [], }) .then(m => { m.react("❌"); @@ -597,17 +589,17 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), components: buttons, embeds: [ epm.setDescription( interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" - }) - ) - ] + emoji: client.emojis.cache.get(o_emoji) || "⭕", + }), + ), + ], }) .then(m => { m.react("❌"); @@ -617,13 +609,13 @@ async function tictactoe(interaction, options = {}) { .edit({ content: interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", }), embeds: [ epm.setDescription( `${interaction.translate("economy/tictactoe:WON", { winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕" + emoji: client.emojis.cache.get(o_emoji) || "⭕", })}\n\`\`\`\n${Args.a1.emoji .replace(o_emoji, "⭕") .replace(x_emoji, "❌")} | ${Args.a2.emoji @@ -644,17 +636,17 @@ async function tictactoe(interaction, options = {}) { .replace(o_emoji, "⭕") .replace(x_emoji, "❌")}\n\`\`\``.replaceAll( dashmoji, - "➖" - ) - ) + "➖", + ), + ), ], - components: [] + components: [], }) .then(m => { m.react("❌"); }); } - } + m.edit({ content: `<@${Args.userid}>`, @@ -662,24 +654,24 @@ async function tictactoe(interaction, options = {}) { epm.setDescription( interaction.translate("economy/tictactoe:WAITING", { user: Args.userid, - emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}` - }) - ) + emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}`, + }), + ), ], - components: [a, b, c] + components: [a, b, c], }); const collector = m.createMessageComponentCollector({ componentType: ComponentType.Button, max: 1, - time: 5000 + time: 5000, }); collector.on("collect", b => { if (b.user.id !== Args.userid) { b.reply({ content: interaction.translate("economy/tictactoe:CANT_PLAY"), - ephemeral: true + ephemeral: true, }); ttt(m); @@ -689,14 +681,14 @@ async function tictactoe(interaction, options = {}) { Args[b.customId] = { style: ButtonStyle.Success, emoji: o_emoji, - disabled: true + disabled: true, }; } else { Args.user = 0; Args[b.customId] = { style: ButtonStyle.Danger, emoji: x_emoji, - disabled: true + disabled: true, }; } b.deferUpdate(); @@ -704,8 +696,8 @@ async function tictactoe(interaction, options = {}) { Object.entries(obj).reduce( (prev, [key, value]) => ({ ...prev, - [key]: fun(key, value) - }), {} + [key]: fun(key, value), + }), {}, ); const objectFilter = (obj, predicate) => Object.keys(obj) @@ -713,7 +705,7 @@ async function tictactoe(interaction, options = {}) { .reduce((res, key) => ((res[key] = obj[key]), res), {}); const Brgs = objectFilter( map(Args, (_, fruit) => fruit.emoji == dashmoji), - (num) => num == true + (num) => num == true, ); if (Object.keys(Brgs).length == 0) { @@ -775,7 +767,7 @@ async function tictactoe(interaction, options = {}) { return m .edit({ content: interaction.translate("economy/tictactoe:TIE"), - embeds: [epm.setDescription(interaction.translate("economy/tictactoe:TIE_DESC"))] + embeds: [epm.setDescription(interaction.translate("economy/tictactoe:TIE_DESC"))], }) .then(m => { m.react(dashmoji); @@ -806,11 +798,11 @@ async function tictactoe(interaction, options = {}) { .replace(o_emoji, "⭕") .replace(x_emoji, "❌")}\n\`\`\``.replaceAll( dashmoji, - "➖" - ) - ) + "➖", + ), + ), ], - components: [] + components: [], }) .then(m => { m.react(dashmoji); @@ -826,9 +818,9 @@ async function tictactoe(interaction, options = {}) { if (collected.size === 0 && reason == "time") m.edit({ content: interaction.translate("economy/tictactoe:NO_ANSWER", { - user: Args.userid + user: Args.userid, }), - components: [] + components: [], }); }); } @@ -841,7 +833,7 @@ async function tictactoe(interaction, options = {}) { .setTitle(interaction.translate("economy/tictactoe:NO_ANSWER_TITLE")) .setAuthor({ name: (interaction.user ? interaction.user : interaction.author).tag, - iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL() + iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL(), }) .setColor(options.timeoutEmbedColor || "#C90000") .setFooter(foot) @@ -849,10 +841,10 @@ async function tictactoe(interaction, options = {}) { .setDescription(interaction.translate("economy/tictactoe:TIMES_UP")); m.interaction.editReply({ content: interaction.translate("economy/tictactoe:NOT_ANSWERED", { - user: opponent.id + user: opponent.id, }), embeds: [embed], - components: [] + components: [], }); } if (reason == "decline") { @@ -860,17 +852,17 @@ async function tictactoe(interaction, options = {}) { .setTitle(interaction.translate("economy/tictactoe:CANCELED")) .setAuthor({ name: (interaction.user ? interaction.user : interaction.author).tag, - iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL() + iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL(), }) .setColor(options.timeoutEmbedColor || "#C90000") .setFooter(foot) .setTimestamp() .setDescription(interaction.translate("economy/tictactoe:CANCELED_DESC", { - user: opponent.id + user: opponent.id, })); m.interaction.editReply({ embeds: [embed], - components: [] + components: [], }); } }); diff --git a/index.js b/index.js index dfdf3c1e..0a365446 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ const { GatewayIntentBits } = require("discord.js"), const client = new JaBa({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.MessageContent, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions ], - allowedMentions: { parse: ["everyone", "roles", "users"] } + allowedMentions: { parse: ["everyone", "roles", "users"] }, }); (async () => { diff --git a/package.json b/package.json index b0142a75..37193e66 100644 --- a/package.json +++ b/package.json @@ -56,26 +56,29 @@ "ecmaVersion": 2020 }, "rules": { - "prefer-const": [ - "error" - ], - "indent": [ - "error", - "tab", - { - "SwitchCase": 1 - } - ], - "quotes": [ - "error", - "double" - ], - "semi": [ - "error", - "always" - ], - "linebreak-style": 0, - "require-atomic-updates": 0 + "arrow-spacing": ["warn", { "before": true, "after": true }], + "comma-dangle": ["error", "always-multiline"], + "comma-spacing": "error", + "comma-style": "error", + "dot-location": ["error", "property"], + "handle-callback-err": "off", + "indent": ["error", "tab", { "SwitchCase": 1 }], + "keyword-spacing": "error", + "max-nested-callbacks": ["error", { "max": 4 }], + "max-statements-per-line": ["error", { "max": 2 }], + "no-console": "off", + "no-multi-spaces": "error", + "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }], + "no-trailing-spaces": ["error"], + "no-var": "error", + "object-curly-spacing": ["error", "always"], + "prefer-const": "error", + "quotes": ["error", "double"], + "semi": ["error", "always"], + "space-in-parens": "error", + "space-infix-ops": "error", + "space-unary-ops": "error", + "yoda": "error" } }, "eslintIgnore": [ diff --git a/scripts/create-db-indexes.js b/scripts/create-db-indexes.js index fd4ac26e..62122910 100644 --- a/scripts/create-db-indexes.js +++ b/scripts/create-db-indexes.js @@ -14,7 +14,7 @@ const config = require("../config"); const dbName = config.mongoDB.split("/").pop(); const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length); const client = new MongoClient(baseURL, { - useUnifiedTopology: true + useUnifiedTopology: true, }); client.connect().then(async () => { @@ -27,20 +27,20 @@ client.connect().then(async () => { console.log(chalk.yellow("Creating guilds index...")); await guilds.createIndex({ - id: 1 + id: 1, }); console.log(chalk.green("Guilds index created.")); console.log(chalk.yellow("Creating members index...")); await members.createIndex({ guildID: 1, - id: -1 + id: -1, }); console.log(chalk.green("Members index created.")); console.log(chalk.yellow("Creating users index...")); await users.createIndex({ - id: 1 + id: 1, }); console.log(chalk.green("Users index created.")); diff --git a/scripts/verify-config.js b/scripts/verify-config.js index 644eff85..2cea528d 100644 --- a/scripts/verify-config.js +++ b/scripts/verify-config.js @@ -49,7 +49,7 @@ const checks = [ const dbName = config.mongoDB.split("/").pop(); const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length); const client = new MongoClient(baseURL, { - useUnifiedTopology: true + useUnifiedTopology: true, }); client.connect().then(async () => { success("Connection to Mongo database success"); @@ -69,8 +69,8 @@ const checks = [ const res = await fetch("https://v1.api.amethyste.moe/generate/blurple", { method: "POST", headers: { - Authorization: `Bearer ${config.apiKeys.amethyste}` - } + Authorization: `Bearer ${config.apiKeys.amethyste}`, + }, }); const result = await res.json(); if (result.status === 401) { @@ -114,7 +114,7 @@ const checks = [ } resolve(); }); - } + }, ]; (async () => {