diff --git a/base/JaBa.js b/base/JaBa.js index e7da9a43..44c70da2 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -63,7 +63,7 @@ class JaBa extends Client { this.player .on("playSong", async (queue, song) => { - const m = await queue.textChannel.send(this.translate("music/play:NOW_PLAYING", { songName: song.name })) + const m = await queue.textChannel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: song.name }) }) if (!song.isLive) { setTimeout(() => { if (!m.deleted) m.delete(); @@ -74,15 +74,15 @@ class JaBa extends Client { }, 600 * 1000); } }) - .on("addSong", (queue, song) => queue.textChannel.send(this.translate("music/play:ADDED_QUEUE", { songName: song.name }))) - .on("addList", (queue, playlist) => queue.textChannel.send(this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: playlist.songs.length }))) + .on("addSong", (queue, song) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE", { songName: song.name }) })) + .on("addList", (queue, playlist) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: playlist.songs.length }) })) .on("searchResult", (message, result) => { let i = 0 const embed = new MessageEmbed() .setDescription(Util.escapeSpoiler(result.map(song => `**${++i} -** ${song.name}`).join("\n"))) - .setFooter(this.translate("music/play:RESULTS_FOOTER")) + .setFooter({ text: this.translate("music/play:RESULTS_FOOTER") }) .setColor(this.config.embed.color); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); }) .on("searchDone", () => {}) .on("searchCancel", message => message.error("misc:TIMES_UP")) @@ -90,13 +90,11 @@ class JaBa extends Client { .on("searchNoResult", message => message.error("music/play:NO_RESULT")) .on("error", (textChannel, e) => { console.error(e); - textChannel.send(this.translate("music/play:ERR_OCCURRED", { - error: e - })); + textChannel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e }) }); }) .on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED"))) - .on("empty", queue => queue.textChannel.send(this.translate("music/play:STOP_EMPTY"))); // .on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED"))) + .on("empty", queue => queue.textChannel.send(this.translate("music/play:STOP_EMPTY"))); this.giveawaysManager = new GiveawaysManager(this, { storage: "./giveaways.json", diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js index 5d7d13d7..80accefe 100644 --- a/commands/Administration/automod.js +++ b/commands/Administration/automod.js @@ -31,7 +31,7 @@ class Automod extends Command { prefix: data.guild.prefix }); } else if (status === "off") { - if (message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first()) { + if (message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first()) { const channel = message.mentions.channels.first(); data.guild.plugins.automod.ignored.push(channel); data.guild.markModified("plugins.automod"); diff --git a/commands/Administration/backup.js b/commands/Administration/backup.js index 02669a3e..a28f6f83 100644 --- a/commands/Administration/backup.js +++ b/commands/Administration/backup.js @@ -78,18 +78,18 @@ class Backup extends Command { backup.fetch(backupID).then(async (backupInfos) => { const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("administration/backup:TITLE_INFO")) + .setAuthor({ name: message.translate("administration/backup:TITLE_INFO") }) // Display the backup ID .addField(message.translate("administration/backup:TITLE_ID"), backupInfos.id, true) // Displays the server from which this backup comes - .addField(message.translate("administration/backup:TITLE_SERVER_ID"), backupInfos.data.guildID, true) + .addField(message.translate("administration/backup:TITLE_SERVER_ID"), backupInfos.data.guildId, true) // Display the size (in mb) of the backup .addField(message.translate("administration/backup:TITLE_SIZE"), `${backupInfos.size}mb`, true) // Display when the backup was created .addField(message.translate("administration/backup:TITLE_CREATED_AT"), message.printDate(new Date(backupInfos.data.createdTimestamp)), true) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); - message.channel.send(embed); + .setFooter({ text: data.config.embed.footer }); + message.channel.send({ embeds: [embed] }); }).catch(() => { // if the backup wasn't found return message.error("administration/backup:NO_BACKUP_FOUND", { diff --git a/commands/Administration/configuration.js b/commands/Administration/configuration.js index 96ec1fdf..81660d0f 100644 --- a/commands/Administration/configuration.js +++ b/commands/Administration/configuration.js @@ -21,9 +21,9 @@ class Configuration extends Command { const guildData = data.guild; const embed = new Discord.MessageEmbed() - .setAuthor(message.guild.name, message.guild.iconURL()) - .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer); + .setAuthor({ name: message.guild.name, iconURL: message.guild.iconURL() }) + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }); // Guild prefix embed.addField(message.translate("administration/configuration:PREFIX_TITLE"), guildData.prefix); @@ -85,7 +85,7 @@ class Configuration extends Command { // Dashboard link embed.addField(message.translate("administration/configuration:DASHBOARD_TITLE"), `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${this.client.config.dashboard.baseURL})`); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js index 5e26f00b..5072e673 100644 --- a/commands/Administration/goodbye.js +++ b/commands/Administration/goodbye.js @@ -49,7 +49,8 @@ class Goodbye extends Command { author: message.author.toString() }); - const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, { + const filter = m => m.author.id === message.author.id; + const collector = message.channel.createMessageCollector({ filter, time: 120000 // 2 minutes }); @@ -100,7 +101,7 @@ class Goodbye extends Command { }); collector.on("end", (_, reason) => { - if (reason === "time") return message.error("misc:TIMEOUT"); + if (reason === "time") return message.error("misc:TIMES_UP"); }); }; } diff --git a/commands/Administration/ignore.js b/commands/Administration/ignore.js index 8babbb57..0e50afa8 100644 --- a/commands/Administration/ignore.js +++ b/commands/Administration/ignore.js @@ -17,7 +17,7 @@ class Ignore extends Command { } async run(message, args, data) { - const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); + const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first(); if (!channel) return message.error("misc:INVALID_CHANNEL"); const ignored = data.guild.ignoredChannels.includes(channel.id); diff --git a/commands/Administration/setfortniteshop.js b/commands/Administration/setfortniteshop.js index e2c36b1d..49a067bb 100644 --- a/commands/Administration/setfortniteshop.js +++ b/commands/Administration/setfortniteshop.js @@ -53,18 +53,23 @@ class Setfortniteshop extends Command { const attachment = new Discord.MessageAttachment(image, "shop.png"); const embed = new Discord.MessageEmbed() - .setAuthor(this.client.translate("general/fortniteshop:DATE", { - date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language) - }, message.guild.data.language), this.client.user.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - })) - .attachFiles(attachment) + .setAuthor({ + name: this.client.translate("general/fortniteshop:DATE", { + date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language) + }, message.guild.data.language), + iconURL: this.client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + }) + }) .setImage("attachment://shop.png") - .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer); - const msg = await channel.send(embed); + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }); + const msg = await channel.send({ + embeds: [embed], + files: [attachment] + }); await msg.react("😍"); await msg.react("😐"); await msg.react("😭"); diff --git a/commands/Administration/slowmode.js b/commands/Administration/slowmode.js index eaac95e7..989f0865 100644 --- a/commands/Administration/slowmode.js +++ b/commands/Administration/slowmode.js @@ -18,7 +18,7 @@ class Slowmode extends Command { } async run(message, args, data) { - const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); + const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first(); if (!channel) return message.error("misc:INVALID_CHANNEL"); const time = args[1]; diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js index f997d8f9..2c68060b 100644 --- a/commands/Administration/welcome.js +++ b/commands/Administration/welcome.js @@ -48,7 +48,9 @@ class Welcome extends Command { message.sendT("administration/welcome:FORM_1", { author: message.author.toString() }); - const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, { + + const filter = m => m.author.id === message.author.id; + const collector = message.channel.createMessageCollector({ filter, time: 120000 // 2 minutes }); @@ -85,7 +87,7 @@ class Welcome extends Command { if (!welcome.channel) { const channel = await Resolvers.resolveChannel({ message: msg, - channelType: "text" + channelType: "GUILD_TEXT" }); if (!channel) return message.error("misc:INVALID_CHANNEL"); @@ -100,7 +102,7 @@ class Welcome extends Command { collector.on("end", (_, reason) => { if (reason === "time") { - return message.error("misc:TIMEOUT"); + return message.error("misc:TIMES_UP"); }; }); }; diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js index 4b19154a..c38d9298 100644 --- a/commands/Economy/achievements.js +++ b/commands/Economy/achievements.js @@ -19,9 +19,9 @@ class Achievements extends Command { async run(message, args, data) { const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("economy/achievements:TITLE")) + .setAuthor({ name: message.translate("economy/achievements:TITLE") }) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", { now: data.userData.achievements.firstCommand.progress.now, @@ -59,7 +59,7 @@ class Achievements extends Command { percent: Math.round(100 * (data.userData.achievements.invite.progress.now / data.userData.achievements.invite.progress.total)) })); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js index caad195a..8f22f0a0 100644 --- a/commands/Economy/leaderboard.js +++ b/commands/Economy/leaderboard.js @@ -18,7 +18,7 @@ class Leaderboard extends Command { } async run(message, args) { - const isOnlyOnMobile = (message.author.presence.clientStatus ? JSON.stringify(Object.keys(message.author.presence.clientStatus)) === JSON.stringify(["mobile"]) : false); + const isOnlyOnMobile = (message.member.presence.clientStatus ? JSON.stringify(Object.keys(message.member.presence.clientStatus)) === JSON.stringify(["mobile"]) : false); const type = args[0]; if (!type || (type !== "credits" && type !== "level" && type !== "rep")) return message.error("economy/leaderboard:MISSING_TYPE"); @@ -37,7 +37,7 @@ class Leaderboard extends Command { table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS")); if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; const newTable = await fetchUsers(membersLeaderboard, table, this.client); - message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``); + message.channel.send({ content: `\`\`\`\n${newTable.toString()}\`\`\`` }); } else if (type === "level") { const members = await this.client.membersData.find({ guildID: message.guild.id @@ -52,9 +52,9 @@ class Leaderboard extends Command { table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL")); if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; const newTable = await fetchUsers(membersLeaderboard, table, this.client); - message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``); + message.channel.send({ content: `\`\`\`\n${newTable.toString()}\`\`\`` }); } else if (type === "rep") { - const users = await this.client.usersData.find().lean(), + const users = await this.client.usersData.find({ rep: { $gt: 0 } }).lean(), usersLeaderboard = users.map((u) => { return { id: u.id, @@ -65,7 +65,7 @@ class Leaderboard extends Command { table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS")); if (usersLeaderboard.length > 20) usersLeaderboard.length = 20; const newTable = await fetchUsers(usersLeaderboard, table, this.client); - message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``); + message.channel.send({ content: `\`\`\`\n${newTable.toString()}\`\`\`` }); }; if (isOnlyOnMobile) message.sendT("economy/leaderboard:MOBILE"); diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js index 56c6aed7..d913f198 100644 --- a/commands/Economy/marry.js +++ b/commands/Economy/marry.js @@ -78,7 +78,9 @@ class Marry extends Command { to: member.user.toString() }); - const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === member.id, { + const filter = m => m.author.id === member.id; + const collector = new Discord.MessageCollector(message.channel, { + filter, time: 120000 }); diff --git a/commands/Economy/money.js b/commands/Economy/money.js index e83be058..81016c0d 100644 --- a/commands/Economy/money.js +++ b/commands/Economy/money.js @@ -37,7 +37,7 @@ class Credits extends Command { const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id)); let globalMoney = 0; - await asyncForEach(commonsGuilds.array(), async (guild) => { + await asyncForEach(commonsGuilds, async (guild) => { const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: guild.id @@ -47,19 +47,24 @@ class Credits extends Command { }); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("economy/money:TITLE", { - username: member.user.username - }), member.user.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - })) + .setAuthor({ + name: message.translate("economy/money:TITLE", { + username: member.user.username + }), + iconURL: member.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + }) + }) .addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) .addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) .addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) - .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer); - message.channel.send(embed); + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }); + message.channel.send({ + embeds: [embed] + }); } }; diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index 0417ea6f..a3925bda 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -42,7 +42,7 @@ class Profile extends Command { const commonsGuilds = client.guilds.cache.filter((g) => g.members.cache.get(member.id)); let globalMoney = 0; - await asyncForEach(commonsGuilds.array(), async (guild) => { + await asyncForEach(commonsGuilds, async (guild) => { const memberData = await client.findOrCreateMember({ id: member.id, guildID: guild.id @@ -52,17 +52,13 @@ class Profile extends Command { }); const profileEmbed = new Discord.MessageEmbed() - .setAuthor(message.translate("economy/profile:TITLE", { + .setAuthor({ name: message.translate("economy/profile:TITLE", { username: member.user.tag - }), member.user.displayAvatarURL({ + }), iconURL: member.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) - .attachFiles([{ - attachment: await userData.getAchievements(), - name: "achievements.png" - }]) + })}) .setImage("attachment://achievements.png") .addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) .addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) @@ -78,10 +74,10 @@ class Profile extends Command { prefix: data.guild.prefix })) .setColor(data.config.embed.color) // Sets the color of the embed - .setFooter(data.config.embed.footer) // Sets the footer of the embed + .setFooter({ text: data.config.embed.footer }) // Sets the footer of the embed .setTimestamp(); - message.channel.send(profileEmbed); // Send the embed in the current channel + message.channel.send({ embeds: [profileEmbed], files: [userData.getAchievements()] }); // Send the embed in the current channel } }; diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js index fe11062d..3c29e5ff 100644 --- a/commands/Economy/slots.js +++ b/commands/Economy/slots.js @@ -19,9 +19,15 @@ class Slots extends Command { async run(message, args, data) { const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"]; - let i1 = 0, j1 = 0, k1 = 0, - i2 = 1, j2 = 1, k2 = 1, - i3 = 2, j3 = 2, k3 = 2; + let i1 = 0, + j1 = 0, + k1 = 0, + i2 = 1, + j2 = 1, + k2 = 1, + i3 = 2, + j3 = 2, + k3 = 2; // Gets three random fruits array const colonnes = [ @@ -77,11 +83,13 @@ class Slots extends Command { msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |"; tmsg.edit(msg); const credits = getCredits(amount, true); - message.channel.send("**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", { - money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, - won: `${credits} ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, - username: message.author.username - })); + message.channel.send({ + content: "**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", { + money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, + won: `${credits} ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, + username: message.author.username + }) + }); const toAdd = credits - amount; data.memberData.money = data.memberData.money + toAdd; if (!data.userData.achievements.slots.achieved) { @@ -106,11 +114,13 @@ class Slots extends Command { msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |"; tmsg.edit(msg); const credits = getCredits(amount, false); - message.channel.send(message.translate("economy/slots:VICTORY", { - money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, - won: `${credits} ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, - username: message.author.username - })); + message.channel.send({ + content: message.translate("economy/slots:VICTORY", { + money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, + won: `${credits} ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, + username: message.author.username + }) + }); const toAdd = credits - amount; data.memberData.money = data.memberData.money + toAdd; if (!data.userData.achievements.slots.achieved) { @@ -132,10 +142,12 @@ class Slots extends Command { }; msg += "| : : : **" + (message.translate("common:DEFEAT").toUpperCase()) + "** : : : |"; - message.channel.send(message.translate("economy/slots:DEFEAT", { - money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, - username: message.author.username - })); + message.channel.send({ + content: message.translate("economy/slots:DEFEAT", { + money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, + username: message.author.username + }) + }); data.memberData.money = data.memberData.money - amount; if (!data.userData.achievements.slots.achieved) { data.userData.achievements.slots.progress.now = 0; diff --git a/commands/Economy/work.js b/commands/Economy/work.js index 10ba9f82..d72fdaaf 100644 --- a/commands/Economy/work.js +++ b/commands/Economy/work.js @@ -40,11 +40,11 @@ class Work extends Command { await data.memberData.save(); const embed = new Discord.MessageEmbed() - .setFooter(message.translate("economy/work:AWARD"), message.author.displayAvatarURL({ + .setFooter({ text: message.translate("economy/work:AWARD"), iconURL: message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .setColor(data.config.embed.color); const award = [ @@ -80,7 +80,7 @@ class Work extends Command { data.memberData.save(); const messageOptions = { - embed + emdeds: embed }; if (!data.userData.achievements.work.achieved) { data.userData.achievements.work.progress.now += 1; diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js index ae8bbcce..d39e711a 100644 --- a/commands/Fun/8ball.js +++ b/commands/Fun/8ball.js @@ -22,7 +22,7 @@ class Eightball extends Command { const answerN = this.client.functions.randomNum(1, 19); const answer = message.translate(`fun/8ball:RESPONSE_${answerN + 1}`); - message.channel.send(answer); + message.channel.send({ content: answer }); } }; diff --git a/commands/Fun/ascii.js b/commands/Fun/ascii.js index fc8ccddd..020fab6a 100644 --- a/commands/Fun/ascii.js +++ b/commands/Fun/ascii.js @@ -25,7 +25,7 @@ class Ascii extends Command { const rendered = await figletAsync(text); - message.channel.send("```" + rendered + "```"); + message.channel.send({ content: "```" + rendered + "```" }); } }; diff --git a/commands/Fun/choice.js b/commands/Fun/choice.js index f0f0df91..02166b4a 100644 --- a/commands/Fun/choice.js +++ b/commands/Fun/choice.js @@ -29,7 +29,7 @@ class Choice extends Command { edit: true }); const result = answers[parseInt(Math.floor(Math.random() * answers.length))]; - message.channel.send("```" + result + "```"); + message.channel.send({ content: "```" + result + "```" }); }, 1500); } }; diff --git a/commands/Fun/findwords.js b/commands/Fun/findwords.js index de904bbf..6915d568 100644 --- a/commands/Fun/findwords.js +++ b/commands/Fun/findwords.js @@ -61,7 +61,9 @@ class FindWords extends Command { }, false, false, "warn"); // init a collector to receive the answers - const collector = new Discord.MessageCollector(message.channel, (m) => !m.author.bot, { + const filter = m => !m.author.bot; + const collector = new Discord.MessageCollector(message.channel, { + filter, time: 20000 }); diff --git a/commands/Fun/fml.js b/commands/Fun/fml.js index d272b808..f80d4d37 100644 --- a/commands/Fun/fml.js +++ b/commands/Fun/fml.js @@ -25,10 +25,10 @@ class Fml extends Command { const embed = new Discord.MessageEmbed() .setDescription(fml.content) - .setFooter(message.translate("fun/fml:FOOTER")) - .setColor(this.client.config.embed.color); + .setFooter({ text: message.translate("fun/fml:FOOTER") }) + .setColor(data.config.embed.color); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Fun/joke.js b/commands/Fun/joke.js index bfe40667..e1d993fa 100644 --- a/commands/Fun/joke.js +++ b/commands/Fun/joke.js @@ -25,10 +25,10 @@ class Joke extends Command { const embed = new Discord.MessageEmbed() .setDescription(joke.toDiscordSpoils()) - .setFooter(message.translate("fun/joke:FOOTER")) - .setColor(this.client.config.embed.color); + .setFooter({ text: message.translate("fun/joke:FOOTER") }) + .setColor(data.config.embed.color); - message.channel.send(embed); + message.channel.send({embeds: [embed] }); } }; diff --git a/commands/Fun/lmg.js b/commands/Fun/lmg.js index 5bd1207f..ad193aea 100644 --- a/commands/Fun/lmg.js +++ b/commands/Fun/lmg.js @@ -20,7 +20,7 @@ class Lmg extends Command { const question = args.join(" "); if (!question) return message.error("fun/lmg:MISSING"); const encodedQuestion = question.replace(/[' '_]/g, "+"); - await message.channel.send(`https://google.gik-team.com/?q=${encodedQuestion}`); + await message.channel.send({ content: `https://google.gik-team.com/?q=${encodedQuestion}` }); message.delete().catch(() => {}); } }; diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js index 09011624..6f394ab4 100644 --- a/commands/Fun/lovecalc.js +++ b/commands/Fun/lovecalc.js @@ -37,16 +37,16 @@ class Lovecalc extends Command { const percent = parseInt(string.substr(0, 2), 10); const embed = new Discord.MessageEmbed() - .setAuthor(`❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`) + .setAuthor({ name: `❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}` }) .setDescription(message.translate("fun/lovecalc:CONTENT", { percent, firstUsername: firstMember.user.username, secondUsername: secondMember.user.username })) - .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer); + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Fun/number.js b/commands/Fun/number.js index 16fabf36..5b588425 100644 --- a/commands/Fun/number.js +++ b/commands/Fun/number.js @@ -30,7 +30,9 @@ class Number extends Command { // Store the date wich the game has started const gameCreatedAt = Date.now(); - const collector = new Discord.MessageCollector(message.channel, m => !m.author.bot, { + const filter = m => !m.author.bot; + const collector = new Discord.MessageCollector(message.channel, { + filter, time: 480000 // 8 minutes }); currentGames[message.guild.id] = true; diff --git a/commands/General/activity.js b/commands/General/activity.js index d3288450..e19bb3c3 100644 --- a/commands/General/activity.js +++ b/commands/General/activity.js @@ -22,153 +22,153 @@ class Activity extends Command { if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); const perms = voice.permissionsFor(this.client.user); - if (!perms.has("CONNECT") || !perms.has("SPEAK")) return message.error("music/play:VOICE_CHANNEL_CONNECT"); + if (!perms.has(Discord.Permissions.FLAGS.CONNECT) || !perms.has(Discord.Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); const activities = ["awkword", "betrayal", "checkers", "chess", "doodlecrew", "fishing", "lettertile", "poker", "spellcast", "wordsnack", "puttparty", "youtube"]; const activity = args[0]; switch (activity) { case "awkword": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "awkword").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "awkword").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Awkword") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Awkword", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "betrayal": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "betrayal").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "betrayal").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Betrayal.io") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Betrayal.io", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "checkers": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "checkers").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "checkers").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Checkers In The Park") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Checkers In The Park", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "chess": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "chess").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "chess").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Chess In The Park") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Chess In The Park", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "doodlecrew": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "doodlecrew").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "doodlecrew").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Doodle Crew") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Doodle Crew", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "fishing": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "fishing").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "fishing").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Fishington.io") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Fishington.io", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "lettertile": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "lettertile").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "lettertile").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Letter Tile") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Letter Tile", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "poker": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "poker").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "poker").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Poker Night") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Poker Night", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "spellcast": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "spellcast").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "spellcast").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Spell Cast") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Spell Cast", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "wordsnack": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "wordsnack").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "wordsnack").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Words Snack") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Words Snack", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "puttparty": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "puttparty").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "puttparty").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Puttparty") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Puttparty", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; case "youtube": - this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "youtube").then(async invite => { + this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "youtube").then(async invite => { const embed = new Discord.MessageEmbed() .setTitle("Youtube Together") .setColor(data.config.embed.color) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Youtube Together", channel: voice.name })}](${invite.code})**`) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }); break; @@ -177,9 +177,9 @@ class Activity extends Command { .setTitle(message.translate("general/activity:TITLE")) .setDescription(activities.join("\n")) .setColor(data.config.embed.color) - .setFooter(message.translate("general/activity:FOOTER")) + .setFooter({ text: message.translate("general/activity:FOOTER") }) .setTimestamp() - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); break; }; } diff --git a/commands/General/fortnite.js b/commands/General/fortnite.js index 722a6dc4..83f7b177 100644 --- a/commands/General/fortnite.js +++ b/commands/General/fortnite.js @@ -65,11 +65,10 @@ class Fortnite extends Command { .setDescription(message.translate("general/fortnite:TITLE", { username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})` })) - .attachFiles(attachment) .setImage("attachment://fortnite-stats-image.png") .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); - message.channel.send(embed); + .setFooter({ text: data.config.embed.footer }); + message.channel.send({ embeds: [embed], files: [attachment] }); m.delete(); } }; diff --git a/commands/General/fortniteshop.js b/commands/General/fortniteshop.js index c0dcf700..2b083c06 100644 --- a/commands/General/fortniteshop.js +++ b/commands/General/fortniteshop.js @@ -41,18 +41,17 @@ class Fortniteshop extends Command { const attachment = new Discord.MessageAttachment(image, "shop.png"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/fortniteshop:HEADER", { + .setAuthor({ name: message.translate("general/fortniteshop:HEADER", { date: message.printDate(new Date(Date.now())) - }), this.client.user.displayAvatarURL({ + }), iconURL: this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) - .attachFiles(attachment) + })}) .setImage("attachment://shop.png") - .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer); - await message.channel.send(embed); + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }); + await message.channel.send({ embeds: [embed], files: [attachment] }); await m.delete(); return; } diff --git a/commands/General/github.js b/commands/General/github.js index 5876c539..4eb0b4cb 100644 --- a/commands/General/github.js +++ b/commands/General/github.js @@ -23,11 +23,12 @@ class Github extends Command { const json = await res.json(); const embed = new Discord.MessageEmbed() - .setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({ + .setAuthor({ name: this.client.user.tag, iconURL: this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + }) + }) .setDescription(`[${message.translate("general/github:CLICK_HERE")}](${json.html_url})`) .addField("Название", json.name, true) .addField("Звёзды", json.stargazers_count, true) @@ -36,9 +37,9 @@ class Github extends Command { .addField(message.translate("general/github:OWNER"), `[${json.owner.login}](${json.owner.html_url})`) .setImage(json.owner.avatar_url) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/hastebin.js b/commands/General/hastebin.js index 7b9553d2..9d246bb6 100644 --- a/commands/General/hastebin.js +++ b/commands/General/hastebin.js @@ -37,10 +37,10 @@ class Hastebin extends Command { const url = `https://hastebin.com/${json.key}.js`; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/hastebin:SUCCESS")) + .setAuthor({ name: message.translate("general/hastebin:SUCCESS") }) .setDescription(url) .setColor(data.config.embed.color); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } catch (e) { message.error("misc:ERR_OCCURRED"); }; diff --git a/commands/General/help.js b/commands/General/help.js index 64cae86d..a65acb59 100644 --- a/commands/General/help.js +++ b/commands/General/help.js @@ -41,18 +41,16 @@ class Help extends Command { }); const groupEmbed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/help:CMD_TITLE", { - cmd: cmd.help.name - })) + .setAuthor({ name: message.translate("general/help:CMD_TITLE", { cmd: cmd.help.name }) }) .addField(message.translate("general/help:FIELD_DESCRIPTION"), description) .addField(message.translate("general/help:FIELD_USAGE"), usage) .addField(message.translate("general/help:FIELD_EXAMPLES"), examples) .addField(message.translate("general/help:FIELD_ALIASES"), cmd.help.aliases.length > 0 ? cmd.help.aliases.map(a => "`" + a + "`").join("\n") : message.translate("general/help:NO_ALIAS")) .addField(message.translate("general/help:FIELD_PERMISSIONS"), cmd.conf.memberPermissions.length > 0 ? cmd.conf.memberPermissions.map((p) => `\`${p}\``).join("\n") : message.translate("general/help:NO_REQUIRED_PERMISSION")) .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer); + .setFooter({ text: this.client.config.embed.footer }); - return message.channel.send(groupEmbed); + return message.channel.send({ embeds: [groupEmbed] }); }; const categories = []; @@ -72,7 +70,7 @@ class Help extends Command { prefix: message.guild ? data.guild.prefix : "" })) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); categories.sort().forEach((cat) => { const tCommands = commands.filter((cmd) => cmd.help.category === cat); embed.addField(`${emojis.categories[cat.toLowerCase()]} ${cat} - (${tCommands.size})`, `${tCommands.map((cmd) => `${cmd.help.name}`).join(", ")}`); @@ -87,14 +85,14 @@ class Help extends Command { donateLink: "https://qiwi.com/n/JONNYBRO/", owner: this.client.config.owner.id })); - embed.setAuthor(message.translate("general/help:TITLE", { + embed.setAuthor({ name: message.translate("general/help:TITLE", { name: this.client.user.username - }), this.client.user.displayAvatarURL({ + }), iconURL: this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })); - return message.channel.send(embed); + })}); + return message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/invitations.js b/commands/General/invitations.js index 570f89d1..b7428068 100644 --- a/commands/General/invitations.js +++ b/commands/General/invitations.js @@ -21,7 +21,7 @@ class Invitations extends Command { let member = await this.client.resolveMember(args[0], message.guild); if (!member) member = message.member; - const invites = await message.guild.fetchInvites().catch(() => {}); + const invites = await message.guild.invites.fetch().catch(() => {}); if (!invites) return message.error("misc:ERR_OCCURRED"); const memberInvites = invites.filter((i) => i.inviter && i.inviter.id === member.user.id); @@ -48,8 +48,8 @@ class Invitations extends Command { const embed = new Discord.MessageEmbed() .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer) - .setAuthor(message.translate("general/invitations:TRACKER")) + .setFooter({ text: data.config.embed.footer }) + .setAuthor({ name: message.translate("general/invitations:TRACKER") }) .setDescription(message.translate("general/invitations:TITLE", { member: member.user.tag, guild: message.guild.name @@ -59,7 +59,7 @@ class Invitations extends Command { })) .addField(message.translate("general/invitations:FIELD_CODES"), content); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/invite.js b/commands/General/invite.js index 5e5c81c7..05b2cd65 100644 --- a/commands/General/invite.js +++ b/commands/General/invite.js @@ -18,14 +18,14 @@ class Invite extends Command { } async run(message, args, data) { - const inviteLink = `https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`; + const inviteLink = this.client.generateInvite({ scopes: ["bot"] , permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }); const voteURL = `https://discordbots.org/bot/${this.client.user.id}/vote`; const supportURL = await this.client.functions.supportLink(this.client); - if (args[0] && args[0] === "copy") return message.channel.send(inviteLink); + if (args[0] && args[0] === "copy") return message.channel.send({ content: inviteLink }); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/invite:LINKS")) + .setAuthor({ name: message.translate("general/invite:LINKS") }) .setDescription(message.translate("general/invite:TIP", { prefix: data.guild.prefix || "" })) @@ -33,9 +33,9 @@ class Invite extends Command { .addField(message.translate("general/invite:VOTE"), voteURL) .addField(message.translate("general/invite:SUPPORT"), supportURL) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/minecraft.js b/commands/General/minecraft.js index 0a7f2883..8e0db356 100644 --- a/commands/General/minecraft.js +++ b/commands/General/minecraft.js @@ -66,9 +66,10 @@ class Minecraft extends Command { const imgAttachment = new Discord.MessageAttachment(await imgRes.buffer(), "success.png"); const mcEmbed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/minecraft:FIELD_NAME", { + .setAuthor({ name: message.translate("general/minecraft:FIELD_NAME", { ip: json.name - })) + }) + }) .addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name) .addField(message.translate("general/minecraft:FIELD_CONNECTED"), message.translate("general/minecraft:PLAYERS", { count: (json.raw.players ? json.raw.players.online : json.players.length) @@ -80,9 +81,9 @@ class Minecraft extends Command { .addField(message.translate("general/minecraft:FIELD_IP"), json.connect) .setColor(data.config.embed.color) .setThumbnail(favicon) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); - m.edit(null, [mcEmbed, imgAttachment]); + m.edit({ content: null, embeds: [mcEmbed], files: [imgAttachment] }); } }; diff --git a/commands/General/permissions.js b/commands/General/permissions.js index b4b18338..21bed371 100644 --- a/commands/General/permissions.js +++ b/commands/General/permissions.js @@ -37,7 +37,7 @@ class Permissions extends Command { }; }); text += `\n${total.allowed} ✅ | ${total.denied} ❌` + "\n```"; - message.channel.send(text); + message.channel.send({ content: text }); } }; diff --git a/commands/General/ping.js b/commands/General/ping.js index 46540452..560996d5 100644 --- a/commands/General/ping.js +++ b/commands/General/ping.js @@ -22,9 +22,7 @@ class Ping extends Command { }).then((m) => { m.sendT("general/ping:CONTENT", { ping: m.createdTimestamp - message.createdTimestamp - }, { - edit: true - }); + }, { edit: true }); }); } }; diff --git a/commands/General/quote.js b/commands/General/quote.js index 4318b3a7..a1da0eb2 100644 --- a/commands/General/quote.js +++ b/commands/General/quote.js @@ -20,14 +20,14 @@ class Quote extends Command { async run(message, args, data) { function embed(m) { const embed = new Discord.MessageEmbed() - .setAuthor(m.author.tag, m.author.displayAvatarURL({ + .setAuthor({ name: m.author.tag, iconURL: m.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .setDescription(m.content) .setColor(m.member ? m.member.roles.highest ? m.member.roles.highest.color : data.config.embed.color : data.config.embed.color) - .setFooter(m.guild.name + " | #" + m.channel.name) + .setFooter({ text: m.guild.name + " | #" + m.channel.name }) .setTimestamp(m.createdTimestamp); if (m.attachments.size > 0) embed.setImage(m.attachments.first().url); return embed; @@ -35,7 +35,7 @@ class Quote extends Command { const msgID = args[0]; if (isNaN(msgID)) { - message.author.send(message.translate("general/quote:MISSING_ID")).then(() => { + message.author.send({ content: message.translate("general/quote:MISSING_ID") }).then(() => { message.delete(); }).catch(() => { message.error("misc:CANNOT_DM"); @@ -66,7 +66,7 @@ class Quote extends Command { return; }).then((msg) => { message.delete(); - message.channel.send(embed(msg)); + message.channel.send({ embeds: [embed(msg)] }); }); } else { channel.messages.fetch(msgID).catch(() => { @@ -78,7 +78,7 @@ class Quote extends Command { return; }).then((msg) => { message.delete(); - message.channel.send(embed(msg)); + message.channel.send({ embeds: [embed(msg)] }); }); }; } diff --git a/commands/General/report.js b/commands/General/report.js index 9f920677..3c82927c 100644 --- a/commands/General/report.js +++ b/commands/General/report.js @@ -29,24 +29,24 @@ class Report extends Command { if (!rep) return message.error("general/report:MISSING_REASON"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/report:TITLE", { + .setAuthor({ name: message.translate("general/report:TITLE", { user: member.user.tag - }), message.author.displayAvatarURL({ + }), iconURL: message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .addField(message.translate("common:AUTHOR"), message.author.tag, true) .addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true) .addField(message.translate("common:REASON"), rep, true) .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id; const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id; - repChannel.send(embed).then(async (m) => { + repChannel.send({ embeds: [embed] }).then(async (m) => { await m.react(success); await m.react(error); }); diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js index f8947f04..0e2d8624 100644 --- a/commands/General/serverinfo.js +++ b/commands/General/serverinfo.js @@ -31,9 +31,9 @@ class Serverinfo extends Command { await guild.members.fetch(); const embed = new Discord.MessageEmbed() - .setAuthor(guild.name, guild.iconURL({ + .setAuthor({ name: guild.name, iconURL: guild.iconURL({ dynamic: true - })) + })}) .setThumbnail(guild.iconURL({ dynamic: true })) @@ -48,14 +48,14 @@ class Serverinfo extends Command { .addField(this.client.customEmojis.crown + message.translate("common:OWNER"), guild.owner, true) .addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || 0, true) .addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"), - `${guild.channels.cache.filter(c => c.type === "text").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "text").size, message.translate("misc:NOUNS:TEXT:1"), message.translate("misc:NOUNS:TEXT:2"), message.translate("misc:NOUNS:TEXT:5"))}` + - "\n" + `${guild.channels.cache.filter(c => c.type === "voice").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "voice").size, message.translate("misc:NOUNS:VOICE:1"), message.translate("misc:NOUNS:VOICE:2"), message.translate("misc:NOUNS:VOICE:5"))}` + - "\n" + `${guild.channels.cache.filter(c => c.type === "category").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "category").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`, true + `${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, message.translate("misc:NOUNS:TEXT:1"), message.translate("misc:NOUNS:TEXT:2"), message.translate("misc:NOUNS:TEXT:5"))}` + + "\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, message.translate("misc:NOUNS:VOICE:1"), message.translate("misc:NOUNS:VOICE:2"), message.translate("misc:NOUNS:VOICE:5"))}` + + "\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`, true ) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js index e6a3de44..9adc92cb 100644 --- a/commands/General/shorturl.js +++ b/commands/General/shorturl.js @@ -29,9 +29,9 @@ class ShortURL extends Command { const embed = new Discord.MessageEmbed() .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer) + .setFooter({ text: data.config.embed.footer }) .setDescription(body); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/someone.js b/commands/General/someone.js index 281d08fd..48f8a098 100644 --- a/commands/General/someone.js +++ b/commands/General/someone.js @@ -30,7 +30,7 @@ class Someone extends Command { format: "png" })) .setColor(data.config.embed.color); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/staff.js b/commands/General/staff.js index b426cae1..90499df0 100644 --- a/commands/General/staff.js +++ b/commands/General/staff.js @@ -19,17 +19,17 @@ class Staff extends Command { async run(message, args, data) { await message.guild.members.fetch(); - const administrators = message.guild.members.cache.filter((m) => m.hasPermission("ADMINISTRATOR") && !m.user.bot); - const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.hasPermission("MANAGE_MESSAGES") && !m.user.bot); + const administrators = message.guild.members.cache.filter((m) => m.permissions.has(Discord.Permissions.FLAGS.ADMINISTRATOR) && !m.user.bot); + const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(Discord.Permissions.FLAGS.MANAGE_MESSAGES) && !m.user.bot); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/staff:TITLE", { + .setAuthor({ name: message.translate("general/staff:TITLE", { guild: message.guild.name - })) + })}) .addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${this.client.customEmojis.status[a.presence.status]} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS"))) .addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${this.client.customEmojis.status[m.presence.status]} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS"))) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); - message.channel.send(embed); + .setFooter({ text: data.config.embed.footer }); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/General/stats.js b/commands/General/stats.js index bf9c8196..c2ba55c7 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -20,8 +20,8 @@ class Stats extends Command { async run(message, args, data) { const statsEmbed = new Discord.MessageEmbed() .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer) - .setAuthor(message.translate("common:STATS")) + .setFooter({ text: data.config.embed.footer }) + .setAuthor({ name: message.translate("common:STATS") }) .setDescription(message.translate("general/stats:MADE")) .addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", { servers: this.client.guilds.cache.size, @@ -46,7 +46,7 @@ class Stats extends Command { donateLink: "https://qiwi.com/n/JONNYBRO/", owner: this.client.config.owner.id })); - message.channel.send(statsEmbed); + message.channel.send({ embeds: [statsEmbed] }); } }; diff --git a/commands/General/suggest.js b/commands/General/suggest.js index f31342c0..6f8ff958 100644 --- a/commands/General/suggest.js +++ b/commands/General/suggest.js @@ -25,23 +25,23 @@ class Suggest extends Command { if (!sugg) return message.error("general/suggest:MISSING_CONTENT"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("general/suggest:TITLE", { + .setAuthor({ name: message.translate("general/suggest:TITLE", { user: message.author.username - }), message.author.displayAvatarURL({ + }), iconURL: message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true) .addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true) .addField(message.translate("common:CONTENT"), sugg) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id; const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id; - suggChannel.send(embed).then(async (m) => { + suggChannel.send({ embeds: [embed] }).then(async (m) => { await m.react(success); await m.react(error); }); diff --git a/commands/General/translate.js b/commands/General/translate.js index 6262e669..a757bbcb 100644 --- a/commands/General/translate.js +++ b/commands/General/translate.js @@ -49,18 +49,19 @@ class Translate extends Command { }); const resEmbed = new Discord.MessageEmbed() - .setAuthor("Переводчик", this.client.user.displayAvatarURL({ + .setAuthor({ name: "Переводчик", iconURL: this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .addField(translated.from.language.iso, "```" + toTranslate + "```") .addField(language, "```" + translated.text + "```") .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); - return pWait.edit("", { - embed: resEmbed + return pWait.edit({ + content: null, + embeds: [resEmbed] }); } }; diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js index 2b4260c6..d1c09b7d 100644 --- a/commands/General/userinfo.js +++ b/commands/General/userinfo.js @@ -41,11 +41,11 @@ class Userinfo extends Command { if (message.guild) member = await message.guild.members.fetch(user).catch(() => {}); const embed = new Discord.MessageEmbed() - .setAuthor(user.tag, user.displayAvatarURL({ + .setAuthor({ name: user.tag, iconURL: user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .setThumbnail(user.displayAvatarURL({ dynamic: true })) @@ -59,7 +59,7 @@ class Userinfo extends Command { format: "png" })) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); if (displayPresence) { embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (user.presence.activity ? user.presence.activity.name : message.translate("general/userinfo:NO_GAME")), true) @@ -95,7 +95,7 @@ class Userinfo extends Command { }; }; - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Images/approved.js b/commands/Images/approved.js index 55b5d6d2..e4c8b551 100644 --- a/commands/Images/approved.js +++ b/commands/Images/approved.js @@ -28,10 +28,13 @@ class Approved extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "approved.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/avatar.js b/commands/Images/avatar.js index 2da4a36f..78adf59b 100644 --- a/commands/Images/avatar.js +++ b/commands/Images/avatar.js @@ -26,10 +26,13 @@ class Avatar extends Command { format: "png" }); - if (message.content.includes("link")) message.channel.send(`<${avatarURL}>`); + if (message.content.includes("link")) message.channel.send({ content: `<${avatarURL}>` }); - const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: avatarURL + }] + }); } }; diff --git a/commands/Images/batslap.js b/commands/Images/batslap.js index cfe588a7..4e50fccd 100644 --- a/commands/Images/batslap.js +++ b/commands/Images/batslap.js @@ -35,10 +35,13 @@ class BatSlap extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "batslap.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/beautiful.js b/commands/Images/beautiful.js index 09397ccd..a5ebc116 100644 --- a/commands/Images/beautiful.js +++ b/commands/Images/beautiful.js @@ -28,10 +28,13 @@ class Beautiful extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "beautiful.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/bed.js b/commands/Images/bed.js index 517e010e..3e3413cc 100644 --- a/commands/Images/bed.js +++ b/commands/Images/bed.js @@ -33,9 +33,13 @@ class Bed extends Command { }), users[1].displayAvatarURL({ format: "png" })); - const attachment = new Discord.MessageAttachment(buffer, "bed.png"); - message.channel.send(attachment); m.delete(); + + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } catch (e) { console.log(e); m.error("misc:ERROR_OCCURRED", null, { diff --git a/commands/Images/brazzers.js b/commands/Images/brazzers.js index 69cbdcda..bfddbafd 100644 --- a/commands/Images/brazzers.js +++ b/commands/Images/brazzers.js @@ -28,10 +28,13 @@ class Brazzers extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "brazzers.png"); m.delete(); - - message.channel.send(attachment); + + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/burn.js b/commands/Images/burn.js index 41a7a71d..990ca229 100644 --- a/commands/Images/burn.js +++ b/commands/Images/burn.js @@ -28,10 +28,13 @@ class Burn extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "burn.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/captcha.js b/commands/Images/captcha.js index 4c91a512..ae4a4139 100644 --- a/commands/Images/captcha.js +++ b/commands/Images/captcha.js @@ -26,9 +26,13 @@ class Captcha extends Command { try { const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=captcha&username=${user.username}&url=${user.displayAvatarURL({ format: "png", size: 512 })}`)); const json = await res.json(); - const attachment = new Discord.MessageAttachment(json.message, "captcha.png"); - message.channel.send(attachment); m.delete(); + + message.channel.send({ + files: [{ + attachment: json.message + }] + }); } catch (e) { console.log(e); m.error("misc:ERR_OCCURRED", null, { diff --git a/commands/Images/challenger.js b/commands/Images/challenger.js index eee11037..39897a7b 100644 --- a/commands/Images/challenger.js +++ b/commands/Images/challenger.js @@ -28,10 +28,13 @@ class Challenger extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "challenger.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/clyde.js b/commands/Images/clyde.js index 53d60e03..db90510c 100644 --- a/commands/Images/clyde.js +++ b/commands/Images/clyde.js @@ -29,8 +29,11 @@ class Clyde extends Command { try { const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`)); const json = await res.json(); - const attachment = new Discord.MessageAttachment(json.message, "clyde.png"); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: json.message + }] + }); m.delete(); } catch (e) { console.log(e); diff --git a/commands/Images/dictator.js b/commands/Images/dictator.js index a9dc96e3..90a13f54 100644 --- a/commands/Images/dictator.js +++ b/commands/Images/dictator.js @@ -28,10 +28,13 @@ class Dictator extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "dictator.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/facepalm.js b/commands/Images/facepalm.js index 57dd2908..742def81 100644 --- a/commands/Images/facepalm.js +++ b/commands/Images/facepalm.js @@ -42,11 +42,13 @@ class Facepalm extends Command { const layer = await Canvas.loadImage("./assets/img/facepalm.png"); ctx.drawImage(layer, 0, 0, 632, 357); - const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "facepalm.png"); - m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/fire.js b/commands/Images/fire.js index 940f6950..53b3b62e 100644 --- a/commands/Images/fire.js +++ b/commands/Images/fire.js @@ -28,10 +28,13 @@ class Fire extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "fire.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/jail.js b/commands/Images/jail.js index 0321abc5..9dda89d6 100644 --- a/commands/Images/jail.js +++ b/commands/Images/jail.js @@ -28,10 +28,13 @@ class Jail extends Command { size: 1024 }) }); - const attachment = new Discord.MessageAttachment(buffer, "jail.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/love.js b/commands/Images/love.js index 04b8cbca..dfc4f5e3 100644 --- a/commands/Images/love.js +++ b/commands/Images/love.js @@ -30,8 +30,11 @@ class Love extends Command { try { const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=ship&user1=${users[0].displayAvatarURL({ format: "png", size: 512 })}&user2=${users[1].displayAvatarURL({ format: "png", size: 512 })}`)); const json = await res.json(); - const attachment = new Discord.MessageAttachment(json.message, "love.png"); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: json.message + }] + }); m.delete(); } catch (e) { console.log(e); diff --git a/commands/Images/mission.js b/commands/Images/mission.js index 14d0ffa4..31137d4e 100644 --- a/commands/Images/mission.js +++ b/commands/Images/mission.js @@ -28,10 +28,13 @@ class Mission extends Command { size: 2048 }) }); - const attachment = new Discord.MessageAttachment(buffer, "mission.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/phcomment.js b/commands/Images/phcomment.js index 5a8a3f96..de862091 100644 --- a/commands/Images/phcomment.js +++ b/commands/Images/phcomment.js @@ -41,9 +41,13 @@ class Phcomment extends Command { }), message: text }); - const attachment = new Discord.MessageAttachment(buffer, "phcomment.png"); - message.channel.send(attachment); m.delete(); + + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } catch (e) { console.log(e); m.error("misc:ERROR_OCCURRED", null, { diff --git a/commands/Images/qrcode.js b/commands/Images/qrcode.js index 90fde6ab..51f562b7 100644 --- a/commands/Images/qrcode.js +++ b/commands/Images/qrcode.js @@ -29,9 +29,11 @@ class Qrcode extends Command { .setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`) .setColor(data.config.embed.color); - pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), { - embed + pleaseWait.edit({ + content: message.translate("images/qrcode:SUCCESS"), + embeds: [embed] }); + } }; diff --git a/commands/Images/rip.js b/commands/Images/rip.js index 6b874b8d..dc1d5333 100644 --- a/commands/Images/rip.js +++ b/commands/Images/rip.js @@ -28,10 +28,13 @@ class Rip extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "rip.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/scary.js b/commands/Images/scary.js index 193a632c..f5922a8c 100644 --- a/commands/Images/scary.js +++ b/commands/Images/scary.js @@ -28,10 +28,13 @@ class Scary extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "scary.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/tobecontinued.js b/commands/Images/tobecontinued.js index 0a22af49..ed473f04 100644 --- a/commands/Images/tobecontinued.js +++ b/commands/Images/tobecontinued.js @@ -28,10 +28,13 @@ class Tobecontinued extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "tobecontinued.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/trash.js b/commands/Images/trash.js index 5ed59cb9..d455ea32 100644 --- a/commands/Images/trash.js +++ b/commands/Images/trash.js @@ -27,10 +27,13 @@ class Trash extends Command { format: "png", size: 512 })); - const attachment = new Discord.MessageAttachment(buffer, "trash.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/triggered.js b/commands/Images/triggered.js index f71ce49f..8cfa36f7 100644 --- a/commands/Images/triggered.js +++ b/commands/Images/triggered.js @@ -30,10 +30,13 @@ class Triggered extends Command { sepia: "true", invert: "true" }); - const attachment = new Discord.MessageAttachment(buffer, "triggered.gif"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/tweet.js b/commands/Images/tweet.js index 51c7ef9e..f08ed12e 100644 --- a/commands/Images/tweet.js +++ b/commands/Images/tweet.js @@ -39,10 +39,13 @@ class Tweet extends Command { avatar3: randomMembers[2].user.displayAvatarURL(), text }); - const attachment = new Discord.MessageAttachment(buffer, "twitter.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/wanted.js b/commands/Images/wanted.js index d5a86b8d..19a863e6 100644 --- a/commands/Images/wanted.js +++ b/commands/Images/wanted.js @@ -28,10 +28,13 @@ class Wanted extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "wanted.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/wasted.js b/commands/Images/wasted.js index c0e9dc64..9a2c19ac 100644 --- a/commands/Images/wasted.js +++ b/commands/Images/wasted.js @@ -28,10 +28,13 @@ class Wasted extends Command { size: 512 }) }); - const attachment = new Discord.MessageAttachment(buffer, "wasted.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: buffer + }] + }); } }; diff --git a/commands/Images/youtube-comment.js b/commands/Images/youtube-comment.js index 23bb1e84..7350b154 100644 --- a/commands/Images/youtube-comment.js +++ b/commands/Images/youtube-comment.js @@ -40,10 +40,13 @@ class YouTubeComment extends Command { }), content: text }); - const attachment = new Discord.MessageAttachment(image, "ytb-comment.png"); m.delete(); - message.channel.send(attachment); + message.channel.send({ + files: [{ + attachment: image + }] + }); } }; diff --git a/commands/Moderation/announcement.js b/commands/Moderation/announcement.js index b178cd86..a14997aa 100644 --- a/commands/Moderation/announcement.js +++ b/commands/Moderation/announcement.js @@ -26,7 +26,10 @@ class Announcement extends Command { let mention = ""; const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + + const filter = m => m.author.id === message.author.id; + const collector = new Discord.MessageCollector(message.channel, { + filter, time: 240000 }); @@ -41,7 +44,10 @@ class Announcement extends Command { tmsg.delete(); msg.delete(); const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); - const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + + const filter = m => m.author.id === message.author.id; + const c = new Discord.MessageCollector(message.channel, { + filter, time: 60000 }); c.on("collect", (m) => { @@ -69,13 +75,13 @@ class Announcement extends Command { if (reason === "time") return message.error("misc:TIMES_UP"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/announcement:TITLE")) + .setAuthor({ name: message.translate("moderation/announcement:TITLE") }) .setColor(data.config.embed.color) - .setFooter(message.author.tag) + .setFooter({ text: message.author.tag }) .setTimestamp() .setDescription(text); - message.channel.send(mention, embed); + message.channel.send({ content: mention, embeds: [embed] }); }); } }; diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js index 3a656d62..71835d4a 100644 --- a/commands/Moderation/ban.js +++ b/commands/Moderation/ban.js @@ -29,7 +29,7 @@ class Ban extends Command { if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF"); // If the user is already banned - const banned = await message.guild.fetchBans(); + const banned = await message.guild.bans.fetch(); if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", { username: user.tag }); @@ -42,7 +42,7 @@ class Ban extends Command { if (member) { const memberPosition = member.roles.highest.position; const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); + if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); if (!member.bannable) return message.error("moderation/ban:MISSING_PERM"); }; @@ -86,14 +86,14 @@ class Ban extends Command { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/ban:CASE", { + .setAuthor({ name: message.translate("moderation/ban:CASE", { count: data.guild.casesCount - })) + })}) .addField(message.translate("common:USER"), `\`${user.tag}\` (${user.toString()})`, true) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) .addField(message.translate("common:REASON"), reason, true) .setColor("#e02316"); - channel.send(embed); + channel.send({ embeds: [embed] }); }; }).catch((err) => { diff --git a/commands/Moderation/checkinvites.js b/commands/Moderation/checkinvites.js index 47720838..52382781 100644 --- a/commands/Moderation/checkinvites.js +++ b/commands/Moderation/checkinvites.js @@ -36,9 +36,9 @@ class Checkinvites extends Command { const embed = new Discord.MessageEmbed() .setDescription(text) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); - const m = await message.channel.send(embed); + const m = await message.channel.send({ embeds: [embed] }); setTimeout(function () { m.delete(); diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index 1c9d86a7..6b98bbaa 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -30,7 +30,7 @@ class Clear extends Command { const newChannel = await message.channel.clone(); await message.channel.delete(); newChannel.setPosition(position); - return newChannel.send(message.translate("moderation/clear:CHANNEL_CLEARED")); + return newChannel.send({ content: message.translate("moderation/clear:CHANNEL_CLEARED") }); }; let amount = args[0]; @@ -43,7 +43,6 @@ class Clear extends Command { let messages = await message.channel.messages.fetch({ limit: 100 }); - messages = messages.array(); if (user) messages = messages.filter((m) => m.author.id === user.id); if (messages.length > amount) messages.length = parseInt(amount, 10); diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js index fbc78c17..44ba2c8e 100644 --- a/commands/Moderation/giveaway.js +++ b/commands/Moderation/giveaway.js @@ -22,7 +22,7 @@ class Giveaway extends Command { if (!status) return message.error("moderation/giveaway:MISSING_STATUS"); if (status === "create") { - const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildID === message.guild.id && !g.ended).length; + const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildId === message.guild.id && !g.ended).length; if (currentGiveaways > 3) return message.error("moderation/giveaway:MAX_COUNT"); const time = args[1]; diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js index 755ce838..09ecbee4 100644 --- a/commands/Moderation/kick.js +++ b/commands/Moderation/kick.js @@ -34,7 +34,7 @@ class Kick extends Command { const memberPosition = member.roles.highest.position; const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); + if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); if (!member.kickable) return message.error("moderation/kick:MISSING_PERM"); await member.send(message.translate("moderation/kick:KICKED_DM", { @@ -73,14 +73,14 @@ class Kick extends Command { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/kick:CASE", { + .setAuthor({ name: message.translate("moderation/kick:CASE", { count: data.guild.casesCount - })) + })}) .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) .addField(message.translate("common:REASON"), reason, true) .setColor("#e88709"); - channel.send(embed); + channel.send({ embeds: [embed] }); }; }).catch(() => { diff --git a/commands/Moderation/mute.js b/commands/Moderation/mute.js index 3fdd5e20..10cae1ee 100644 --- a/commands/Moderation/mute.js +++ b/commands/Moderation/mute.js @@ -25,7 +25,7 @@ class Mute extends Command { const memberPosition = member.roles.highest.position; const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); + if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); const memberData = await this.client.findOrCreateMember({ id: member.id, @@ -38,7 +38,7 @@ class Mute extends Command { if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED"); message.guild.channels.cache.forEach((channel) => { - channel.updateOverwrite(member.id, { + channel.permissionOverwrites.edit(member.id, { SEND_MESSAGES: false, ADD_REACTIONS: false, CONNECT: false @@ -90,16 +90,16 @@ class Mute extends Command { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/mute:CASE", { + .setAuthor({ name: message.translate("moderation/mute:CASE", { count: data.guild.casesCount - })) + })}) .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) .addField(message.translate("common:REASON"), reason, true) .addField(message.translate("common:DURATION"), time, true) .addField(message.translate("common:EXPIRY"), message.printDate(new Date(Date.now() + ms(time))), true) .setColor("#f44271"); - channel.send(embed); + channel.send({ embeds: [embed] }); } } }; diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js index 96486f0a..05680b7a 100644 --- a/commands/Moderation/poll.js +++ b/commands/Moderation/poll.js @@ -25,7 +25,10 @@ class Poll extends Command { let mention = ""; const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + + const filter = m => m.author.id === message.author.id; + const collector = new Discord.MessageCollector(message.channel, { + filter, time: 240000 }); @@ -40,7 +43,10 @@ class Poll extends Command { tmsg.delete(); msg.delete(); const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); - const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { + + const filter = m => m.author.id === message.author.id; + const c = new Discord.MessageCollector(message.channel, { + filter, time: 60000 }); @@ -77,14 +83,14 @@ class Poll extends Command { ]; const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("moderation/poll:TITLE")) + .setAuthor({ name: message.translate("moderation/poll:TITLE") }) .setColor(data.config.embed.color) .addField(question, message.translate("moderation/poll:REACT", { success: emojis[0].toString(), error: emojis[1].toString() })); - message.channel.send(mention, embed).then(async (m) => { + message.channel.send({ content: mention, embeds: [embed] }).then(async (m) => { await m.react(emojis[0]); await m.react(emojis[1]); }); diff --git a/commands/Moderation/sanctions.js b/commands/Moderation/sanctions.js index 0e30fec6..c7384053 100644 --- a/commands/Moderation/sanctions.js +++ b/commands/Moderation/sanctions.js @@ -27,25 +27,25 @@ class Sanctions extends Command { }); const embed = new Discord.MessageEmbed() - .setAuthor(user.tag, user.displayAvatarURL({ + .setAuthor({ name: user.tag, iconURL: user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); if (memberData.sanctions.length < 1) { embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", { username: user.tag })); - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); } else { memberData.sanctions.forEach((s) => { embed.addField(s.type + " | #" + s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true); }); }; - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js index e397e3b8..8829c674 100644 --- a/commands/Moderation/unban.js +++ b/commands/Moderation/unban.js @@ -43,7 +43,7 @@ class Unban extends Command { if (!user) return message.error("misc:NO_USER_FOUND_ID", { id: args[0] }); // check if the user is banned - const banned = await message.guild.fetchBans(); + const banned = await message.guild.bans.fetch(); if (!banned.some((e) => e.user.id === user.id)) return message.success("moderation/unban:NOT_BANNED", { username: user.tag }); // Unban user diff --git a/commands/Moderation/unmute.js b/commands/Moderation/unmute.js index 560ec391..e96239a2 100644 --- a/commands/Moderation/unmute.js +++ b/commands/Moderation/unmute.js @@ -22,7 +22,7 @@ class Unmute extends Command { const memberPosition = member.roles.highest.position; const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); + if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); const memberData = await this.client.findOrCreateMember({ id: member.id, diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 5c7388a7..8fd54257 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -31,7 +31,7 @@ class Warn extends Command { const memberPosition = member.roles.highest.position; const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); + if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); const reason = args.slice(1).join(" "); if (!reason) return message.error("moderation/warn:MISSING_REASON"); @@ -67,9 +67,9 @@ class Warn extends Command { reason })); caseInfo.type = "ban"; - embed.setAuthor(message.translate("moderation/ban:CASE", { + embed.setAuthor({ name: message.translate("moderation/ban:CASE", { count: data.guild.casesCount - })) + })}) .setColor("#e02316"); message.guild.members.ban(member).catch(() => {}); message.success("moderation/setwarns:AUTO_BAN", { @@ -88,9 +88,9 @@ class Warn extends Command { reason })); caseInfo.type = "kick"; - embed.setAuthor(message.translate("moderation/kick:CASE", { + embed.setAuthor({ name: message.translate("moderation/kick:CASE", { count: data.guild.casesCount - })) + })}) .setColor("#e88709"); member.kick().catch(() => {}); message.success("moderation/setwarns:AUTO_KICK", { @@ -107,9 +107,9 @@ class Warn extends Command { reason })); caseInfo.type = "warn"; - embed.setAuthor(message.translate("moderation/warn:CASE", { + embed.setAuthor({ name: message.translate("moderation/warn:CASE", { caseNumber: data.guild.casesCount - })) + })}) .setColor("#8c14e2"); message.success("moderation/warn:WARNED", { username: member.user.tag, @@ -122,7 +122,7 @@ class Warn extends Command { if (data.guild.plugins.modlogs) { const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); if (!channel) return; - channel.send(embed); + channel.send({ embeds: [embed] }); }; } }; diff --git a/commands/Music/back.js b/commands/Music/back.js index f459234c..faefa06d 100644 --- a/commands/Music/back.js +++ b/commands/Music/back.js @@ -26,16 +26,16 @@ class Back extends Command { if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/back:DESCRIPTION")) + .setAuthor({ name: message.translate("music/back:DESCRIPTION") }) .setThumbnail(queue.tracks[0].thumbnail) - .setFooter(data.config.embed.footer) - .setColor(data.config.embed.color); + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }); - const m = await message.channel.send(embed); + const m = await message.channel.send({ embeds: [embed] }); this.client.player.previous(message); embed.setDescription(message.translate("music/back:SUCCESS")); - m.edit(embed); + m.edit({ embeds: [embed] }); } }; diff --git a/commands/Music/clips.js b/commands/Music/clips.js index a6127365..026d0a74 100644 --- a/commands/Music/clips.js +++ b/commands/Music/clips.js @@ -32,9 +32,9 @@ class Clips extends Command { .setTitle(message.translate("music/clips:EMBED_TITLE")) .setDescription(clips.join("\n")) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer) - .setTimestamp() - message.channel.send(embed); + .setFooter({ text: data.config.embed.footer }) + .setTimestamp(); + message.channel.send({ embeds: [embed] }); }); } }; diff --git a/commands/Music/filters.js b/commands/Music/filters.js index 5953212f..7689da0b 100644 --- a/commands/Music/filters.js +++ b/commands/Music/filters.js @@ -39,7 +39,7 @@ class Filters extends Command { .addField("** **", filtersStatuses[1].join("\n"), true) .setColor(data.config.embed.color); - message.channel.send(list); + message.channel.send({ embeds: [list] }); } }; diff --git a/commands/Music/jump.js b/commands/Music/jump.js index eefb4087..07cd1f83 100644 --- a/commands/Music/jump.js +++ b/commands/Music/jump.js @@ -27,18 +27,18 @@ class Jump extends Command { if (number < 0) return message.error("music/jump:NO_PREV_SONG", { prefix: data.guild.prefix }); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/jump:SUCCESS")) + .setAuthor({ name: message.translate("music/jump:SUCCESS") }) .setThumbnail(queue.songs[number].thumbnail) - .setFooter(data.config.embed.footer) + .setFooter({ text: data.config.embed.footer }) .setColor(data.config.embed.color); - const m = await message.channel.send(embed); + const m = await message.channel.send({ embeds: [embed] }); this.client.player.jump(message, number); embed.setDescription(message.translate("music/play:NOW_PLAYING", { songName: queue.songs[number].name })); - m.edit(embed); + m.edit({ embeds: [embed] }); } }; diff --git a/commands/Music/lyrics.js b/commands/Music/lyrics.js index a8e8a444..ad715f12 100644 --- a/commands/Music/lyrics.js +++ b/commands/Music/lyrics.js @@ -27,7 +27,7 @@ class Lyrics extends Command { songName })) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); try { const songNameFormated = songName @@ -46,7 +46,7 @@ class Lyrics extends Command { }; embed.setDescription(lyrics); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } catch (e) { console.log(e); diff --git a/commands/Music/np.js b/commands/Music/np.js index 7764f063..66f3be76 100644 --- a/commands/Music/np.js +++ b/commands/Music/np.js @@ -29,17 +29,17 @@ class Np extends Command { // Generate discord embed to display song informations const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/queue:TITLE")) + .setAuthor({ name: message.translate("music/queue:TITLE") }) .setThumbnail(track.thumbnail) .addField(message.translate("music/np:T_TITLE"), `[${track.name}](${track.url})`) .addField(message.translate("music/np:T_CHANNEL"), track.uploader.name ? track.uploader.name : "Отсутствует") .addField(message.translate("music/np:T_DURATION"), `${queue.formattedCurrentTime} / ${track.formattedDuration}`) .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer) + .setFooter({ text: data.config.embed.footer }) .setTimestamp(); // Send the embed in the current channel - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Music/play.js b/commands/Music/play.js index 43157ba7..eb69b20f 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -1,4 +1,5 @@ -const Command = require("../../base/Command.js"); +const Command = require("../../base/Command.js"), + { Permissions } = require("discord.js"); class Play extends Command { constructor(client) { @@ -25,7 +26,7 @@ class Play extends Command { // Check my permissions const perms = voice.permissionsFor(this.client.user); - if (!perms.has("CONNECT") || !perms.has("SPEAK")) return message.error("music/play:VOICE_CHANNEL_CONNECT"); + if (!perms.has(Permissions.FLAGS.CONNECT) || !perms.has(Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); try { this.client.player.play(message, args.join(" ")); diff --git a/commands/Music/queue.js b/commands/Music/queue.js index 366e959d..2fa1634a 100644 --- a/commands/Music/queue.js +++ b/commands/Music/queue.js @@ -27,21 +27,21 @@ class Queue extends Command { if (queue.songs.length === 1) { const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ + .setAuthor({ name: message.translate("music/queue:TITLE"), iconURL: message.guild.iconURL({ dynamic: true - })) + })}) .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*Добавил ${queue.songs[0].member}*\n`) .setColor(data.config.embed.color); - return message.channel.send(embed); + return message.channel.send({ embeds: [embed] }); }; const FieldsEmbed = new Pagination.FieldsEmbed(); FieldsEmbed.embed .setColor(data.config.embed.color) - .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ + .setAuthor({ name: message.translate("music/queue:TITLE"), iconURL: message.guild.iconURL({ dynamic: true - })) + })}) .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*Добавил ${queue.songs[0].member}*\n`); FieldsEmbed.setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : []) diff --git a/commands/Music/skip.js b/commands/Music/skip.js index e039c67d..9bbfbc02 100644 --- a/commands/Music/skip.js +++ b/commands/Music/skip.js @@ -26,18 +26,18 @@ class Skip extends Command { if (!queue.songs[1]) return message.error("music/skip:NO_NEXT_SONG"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/skip:SUCCESS")) + .setAuthor({ name: message.translate("music/skip:SUCCESS") }) .setThumbnail(queue.songs[1].thumbnail) - .setFooter(data.config.embed.footer) + .setFooter({ text: data.config.embed.footer }) .setColor(data.config.embed.color); - const m = await message.channel.send(embed); + const m = await message.channel.send({ embeds: [embed] }); this.client.player.skip(message); embed.setDescription(message.translate("music/play:NOW_PLAYING", { songName: queue.songs[1].name })); - m.edit(embed); + m.edit({ embeds: [embed] }); } }; diff --git a/commands/Music/stop.js b/commands/Music/stop.js index 6ad0fbea..ecc5985a 100644 --- a/commands/Music/stop.js +++ b/commands/Music/stop.js @@ -25,15 +25,15 @@ class Stop extends Command { if (!queue) return message.error("music/play:NOT_PLAYING"); const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/stop:DESCRIPTION")) - .setFooter(data.config.embed.footer) + .setAuthor({ name: message.translate("music/stop:DESCRIPTION") }) + .setFooter({ text: data.config.embed.footer }) .setColor(data.config.embed.color); - const m = await message.channel.send(embed); + const m = await message.channel.send({ embeds: [embed] }); this.client.player.stop(message); embed.setDescription(message.translate("music/stop:SUCCESS")); - m.edit(embed); + m.edit({ embeds: [embed] }); } }; diff --git a/commands/NSFW/hentai.js b/commands/NSFW/hentai.js index 849b7d92..eb2cd9ab 100644 --- a/commands/NSFW/hentai.js +++ b/commands/NSFW/hentai.js @@ -23,7 +23,7 @@ class Hentai extends Command { var gif = null; const embed = new Discord.MessageEmbed() .setColor(data.config.embed.color) - .setFooter(data.config.embed.footer) + .setFooter({ text: data.config.embed.footer }) .setTimestamp() switch (category) { @@ -95,7 +95,7 @@ class Hentai extends Command { })) break; }; - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index 0665b037..ed2ebe74 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -16,13 +16,7 @@ class Eval extends Command { }); } - // eslint-disable-next-line no-unused-vars async run(message, args, data) { - // eslint-disable-next-line no-unused-vars - const usersData = this.client.usersData; - // eslint-disable-next-line no-unused-vars - const guildsData = this.client.guildsData; - const content = message.content.split(" ").slice(1).join(" "); const result = new Promise((resolve) => resolve(eval(content))); @@ -31,16 +25,12 @@ class Eval extends Command { depth: 0 }); if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N"); - message.channel.send(output, { - code: "js" - }); + message.channel.send({ content: "```js\n" + output + "```" }); }).catch((err) => { console.error(err); err = err.toString(); if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N"); - message.channel.send(err, { - code: "js" - }); + message.channel.send({ content: "```js\n" + err + "```" }); }); } }; diff --git a/commands/Owner/say.js b/commands/Owner/say.js index 9a40eb2f..db90f4e1 100644 --- a/commands/Owner/say.js +++ b/commands/Owner/say.js @@ -24,42 +24,42 @@ class Say extends Command { args = args.join(" ").split(split); for (var i = 0; i < args.length; i++) args[i] = args[i].trim(); - if (message.attachments.size > 0) var attachment = message.attachments.array()[0].url; + if (message.attachments.size > 0) var attachment = message.attachments.first().url; if (args[1] && !args[2]) { message.delete(); const saychannel = message.guild.channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]); - saychannel.startTyping(); + saychannel.sendTyping(); setTimeout(function () { - if (attachment) saychannel.send(args[0], { + if (attachment) saychannel.send({ + content: args[0], files: [attachment] }); - else saychannel.send(args[0]); - saychannel.stopTyping(); + else saychannel.send({ content: args[0] }); }, 2000); } else if (args[2]) { const saychannel = this.client.guilds.cache.find(guild => guild.name == args[2] || guild.id == args[2]).channels.cache.find(channel => channel.name == args[1] || channel.id == args[1]); - saychannel.startTyping(); + saychannel.sendTyping(); setTimeout(function () { - if (attachment) saychannel.send(args[0], { + if (attachment) saychannel.send({ + content: args[0], files: [attachment] }); - else saychannel.send(args[0]); - saychannel.stopTyping(); + else saychannel.send({ content: args[0] }); }, 2000); } else { message.delete(); const saychannel = message.channel; - saychannel.startTyping(); + saychannel.sendTyping(); setTimeout(function () { - if (attachment) saychannel.send(args[0], { + if (attachment) saychannel.send({ + content: args[0], files: [attachment] }); - else saychannel.send(args[0]); - saychannel.stopTyping(); + else saychannel.send({ content: args[0] }); }, 2000); }; } diff --git a/commands/Owner/servers-list.js b/commands/Owner/servers-list.js index a288c9ff..93f2cd4c 100644 --- a/commands/Owner/servers-list.js +++ b/commands/Owner/servers-list.js @@ -18,7 +18,7 @@ class ServersList extends Command { } async run(message, args, data) { - if (!message.channel.type != "dm") message.delete(); + if (!message.channel.type != "DM") message.delete(); let i0 = 0, i1 = 10, @@ -31,23 +31,26 @@ class ServersList extends Command { .join("\n"); const embed = new Discord.MessageEmbed() - .setAuthor(message.author.tag, message.author.displayAvatarURL({ + .setAuthor({ name: message.author.tag, iconURL: message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .setColor(data.config.embed.color) - .setFooter(this.client.user.username) + .setFooter({ text: this.client.user.username }) .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.ceil(this.client.guilds.cache.size/10)}`) .setDescription(description); - const msg = await message.channel.send(embed); + const msg = await message.channel.send({ embeds: [embed] }); await msg.react("⬅"); await msg.react("➡"); await msg.react("❌"); - const collector = msg.createReactionCollector((reaction, user) => user.id === message.author.id); + const filter = (reaction, user) => user.id === message.author.id; + const collector = msg.createReactionCollector({ filter, + time: 30000 + }); collector.on("collect", async (reaction) => { if (reaction._emoji.name === "⬅") { @@ -71,7 +74,7 @@ class ServersList extends Command { .setDescription(description); // Edit the message - msg.edit(embed); + msg.edit({ embeds: [embed] }); }; if (reaction._emoji.name === "➡") { @@ -95,7 +98,7 @@ class ServersList extends Command { .setDescription(description); // Edit the message - msg.edit(embed); + msg.edit({ embeds: [embed] }); }; if (reaction._emoji.name === "❌") return msg.delete(); diff --git a/dashboard/routes/discord.js b/dashboard/routes/discord.js index 9a86387b..01e8e39c 100644 --- a/dashboard/routes/discord.js +++ b/dashboard/routes/discord.js @@ -81,10 +81,10 @@ router.get("/callback", async (req, res) => { const logsChannel = req.client.channels.cache.get(req.client.config.dashboard.logs); if (!userDB.logged && logsChannel && user) { const embed = new Discord.MessageEmbed() - .setAuthor(user.username, user.displayAvatarURL()) + .setAuthor({ name: user.username, iconURL: user.displayAvatarURL() }) .setColor(req.client.config.embed.color) .setDescription(req.client.translate("dashboard:FIRST_LOGIN", { user: user.tag })); - logsChannel.send(embed); + logsChannel.send({ embeds: [embed] }); userDB.logged = true; userDB.save(); }; diff --git a/dashboard/utils.js b/dashboard/utils.js index 5a755c0f..7c1ae1d4 100644 --- a/dashboard/utils.js +++ b/dashboard/utils.js @@ -1,4 +1,4 @@ -const Discord = require("discord.js"); +const { Permissions } = require("discord.js"); /** * Fetch guild informations @@ -24,8 +24,8 @@ async function fetchUser(userData, client, query) { if (userData.guilds) { userData.guilds.forEach((guild) => { if (!client.guilds.cache.get(guild.id)) return; - const perms = new Discord.Permissions(guild.permissions); - if (perms.has("MANAGE_GUILD")) guild.admin = true; + const perms = new Permissions(BigInt(guild.permissions)); + if (perms.has(Permissions.FLAGS.MANAGE_GUILD)) guild.admin = true; guild.settingsUrl = (client.guilds.cache.get(guild.id) ? `/manage/${guild.id}/` : `https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=8&guild_id=${guild.id}`); guild.statsUrl = (client.guilds.cache.get(guild.id) ? `/stats/${guild.id}/` : `https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=8&guild_id=${guild.id}`); diff --git a/dashboard/views/manager/guild.ejs b/dashboard/views/manager/guild.ejs index 4010c1ee..ae6a5402 100644 --- a/dashboard/views/manager/guild.ejs +++ b/dashboard/views/manager/guild.ejs @@ -101,13 +101,13 @@ <% if(guild.plugins.suggestions && bot.channels.cache.has(guild.plugins.suggestions)) { %> - <% guild.channels.cache.filter((ch) => ch.type === "text" && ch.id !== guild.plugins.suggestions).forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.suggestions).forEach((ch) => { %> <% }); %> <% } else { %> - <% guild.channels.cache.filter((ch) => ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> @@ -119,13 +119,13 @@ <% if(guild.plugins.reports && bot.channels.cache.has(guild.plugins.reports)) { %> - <% guild.channels.cache.filter((ch) => ch.type === "text" && ch.id !== guild.plugins.reports).forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.reports).forEach((ch) => { %> <% }); %> <% } else { %> - <% guild.channels.cache.filter((ch) => ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> @@ -137,13 +137,13 @@ <% if(guild.plugins.modlogs && bot.channels.cache.has(guild.plugins.modlogs)) { %> - <% guild.channels.cache.filter((ch) => ch.type === "text" && ch.id !== guild.plugins.modlogs).forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.modlogs).forEach((ch) => { %> <% }); %> <% } else { %> - <% guild.channels.cache.filter((ch) => ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> @@ -155,13 +155,13 @@ <% if(guild.plugins.birthdays && bot.channels.cache.has(guild.plugins.birthdays)) { %> - <% guild.channels.cache.filter((ch) => ch.type === "text" && ch.id !== guild.plugins.birthdays).forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.birthdays).forEach((ch) => { %> <% }); %> <% } else { %> - <% guild.channels.cache.filter((ch) => ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> @@ -173,13 +173,13 @@ <% if(guild.plugins.fortniteshop && bot.channels.cache.has(guild.plugins.fortniteshop)) { %> - <% guild.channels.cache.filter((ch) => ch.type === "text" && ch.id !== guild.plugins.fortniteshop).forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.fortniteshop).forEach((ch) => { %> <% }); %> <% } else { %> - <% guild.channels.cache.filter((ch) => ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> @@ -218,13 +218,13 @@ - <% guild.channels.cache.filter((ch) => ch.id !== guild.plugins.welcome.channel && ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.id !== guild.plugins.welcome.channel && ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); } else { %> - <% guild.channels.cache.filter((ch) => ch.id !== guild.channels.cache.first().id && ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.id !== guild.channels.cache.first().id && ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> @@ -281,13 +281,13 @@ - <% guild.channels.cache.filter((ch) => ch.id !== guild.plugins.goodbye.channel && ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.id !== guild.plugins.goodbye.channel && ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); } else { %> - <% guild.channels.cache.filter((ch) => ch.id !== guild.channels.cache.first().id && ch.type === "text").forEach((ch) => { %> + <% guild.channels.cache.filter((ch) => ch.id !== guild.channels.cache.first().id && ch.type === "GUILD_TEXT").forEach((ch) => { %> <% }); %> <% } %> diff --git a/events/guildCreate.js b/events/guildCreate.js index 70a7a254..0cc61eba 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -7,8 +7,8 @@ module.exports = class { async run(guild) { if (this.client.config.proMode) { - if ((!this.client.config.proUsers.includes(guild.ownerID) || this.guilds.filter((g) => g.ownerID === guild.ownerID) > 1) && guild.ownerID !== this.client.config.owner.id) { - this.client.logger.log(`${guild.ownerID} tried to invite JaBa on its server.`); + if ((!this.client.config.proUsers.includes(guild.ownerId) || this.guilds.filter((g) => g.ownerId === guild.ownerId) > 1) && guild.ownerId !== this.client.config.owner.id) { + this.client.logger.log(`${guild.ownerId} tried to invite JaBa on its server.`); return guild.leave(); }; }; @@ -16,7 +16,7 @@ module.exports = class { const messageOptions = {}; const userData = await this.client.findOrCreateUser({ - id: guild.ownerID + id: guild.ownerId }); if (!userData.achievements.invite.achieved) { userData.achievements.invite.progress.now += 1; @@ -30,10 +30,10 @@ module.exports = class { }; const thanksEmbed = new Discord.MessageEmbed() - .setAuthor("Спасибо что добавили меня на свой сервер!") - .setDescription(`Для настроек используйте \`${this.client.config.prefix}help\` и посмотрите на административные команды!\nЧтобы изменить язык используйте \`${this.client.config.prefix}setlang [язык]\`.`) - .setColor(this.client.config.embed.color) - .setFooter(this.client.config.embed.footer) + .setAuthor({ name: "Спасибо что добавили меня на свой сервер!" }) + .setDescription(`Для настроек используйте \`${data.config.prefix}help\` и посмотрите на административные команды!\nЧтобы изменить язык используйте \`${this.client.config.prefix}setlang [язык]\`.`) + .setColor(data.config.embed.color) + .setFooter({ text: data.config.embed.footer }) .setTimestamp(); messageOptions.embed = thanksEmbed; @@ -43,9 +43,9 @@ module.exports = class { // Sends log embed in the logs channel const logsEmbed = new Discord.MessageEmbed() - .setAuthor(guild.name, guild.iconURL()) + .setAuthor({ name: guild.name, iconURL: guild.iconURL()}) .setColor("#32CD32") .setDescription(text); - this.client.channels.cache.get(this.client.config.support.logs).send(logsEmbed); + this.client.channels.cache.get(data.config.support.logs).send(logsEmbed); } }; \ No newline at end of file diff --git a/events/guildDelete.js b/events/guildDelete.js index ccc393a1..2a18490e 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -10,7 +10,7 @@ module.exports = class { // Sends log embed in the logs channel const embed = new Discord.MessageEmbed() - .setAuthor(guild.name, guild.iconURL()) + .setAuthor({ name: guild.name, iconURL: guild.iconURL()}) .setColor("#B22222") .setDescription(text); this.client.channels.cache.get(this.client.config.support.logs).send(embed); diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 1d3fb1f9..9d43acd2 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -34,7 +34,7 @@ module.exports = class { }); if (memberData.mute.muted && memberData.mute.endDate > Date.now()) { member.guild.channels.cache.forEach((channel) => { - channel.updateOverwrite(member.id, { + channel.permissionOverwrites.edit(member.id, { SEND_MESSAGES: false, ADD_REACTIONS: false, CONNECT: false @@ -141,9 +141,9 @@ module.exports = class { ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "welcome-image.png"); - channel.send(message, attachment); + channel.send({ content: message, files: [attachment] }); } else { - channel.send(message); + channel.send({ content: message }); }; }; }; diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index cc28a463..0cff616a 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -123,9 +123,9 @@ module.exports = class { ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "goodbye-image.png"); - channel.send(message, attachment); + channel.send({ content: message, files: [attachment] }); } else { - channel.send(message); + channel.send({ content: message }); }; }; }; diff --git a/events/message.js b/events/messageCreate.js similarity index 92% rename from events/message.js rename to events/messageCreate.js index bf54fd25..97e3e0da 100644 --- a/events/message.js +++ b/events/messageCreate.js @@ -1,6 +1,5 @@ -const { string } = require("mathjs"); - -const xpCooldown = {}, +const { Permissions } = require("discord.js"), + xpCooldown = {}, cmdCooldown = {}; module.exports = class { @@ -53,7 +52,7 @@ module.exports = class { if (message.guild) { await updateXp(client, message, data); - if (!message.channel.permissionsFor(message.member).has("MANAGE_MESSAGES") && !message.editedAt) { + if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MANAGE_MESSAGES) && !message.editedAt) { const channelSlowmode = data.guild.slowmode.channels.find((ch) => ch.id === message.channel.id); if (channelSlowmode) { const uSlowmode = data.guild.slowmode.users.find((d) => d.id === (message.author.id + message.channel.id)); @@ -82,7 +81,7 @@ module.exports = class { if (data.guild.plugins.automod.enabled && !data.guild.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("MANAGE_MESSAGES")) { + if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MANAGE_MESSAGES)) { message.delete(); message.author.send("```" + message.content + "```"); return message.error("administration/automod:DELETED", { @@ -126,14 +125,14 @@ module.exports = class { if (!cmd && !customCommandAnswer && message.guild) return; else if (!cmd && !customCommandAnswer && !message.guild) return message.sendT("misc:HELLO_DM"); - if (message.guild && data.guild.ignoredChannels.includes(message.channel.id) && !message.member.hasPermission("MANAGE_MESSAGES")) { + if (message.guild && data.guild.ignoredChannels.includes(message.channel.id) && !message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) { message.delete(); return message.author.send(message.translate("misc:RESTRICTED_CHANNEL", { channel: message.channel.toString() })); }; - if (customCommandAnswer) return message.channel.send(customCommandAnswer); + if (customCommandAnswer) return message.channel.send({ content: customCommandAnswer }); if (cmd.conf.guildOnly && !message.guild) return message.error("misc:GUILD_ONLY"); if (message.guild) { @@ -158,7 +157,7 @@ module.exports = class { }); if (neededPermissions.length > 0) return message.error("misc:MISSING_MEMBER_PERMS", { list: neededPermissions.map((p) => `\`${p}\``).join(", ") }); - if (!message.channel.permissionsFor(message.member).has("MENTION_EVERYONE") && (message.content.includes("@everyone") || message.content.includes("@here"))) return message.error("misc:EVERYONE_MENTION"); + if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MENTION_EVERYONE) && (message.content.includes("@everyone") || message.content.includes("@here"))) return message.error("misc:EVERYONE_MENTION"); if (!message.channel.nsfw && cmd.conf.nsfw) return message.error("misc:NSFW_COMMAND"); }; diff --git a/events/messageUpdate.js b/events/messageUpdate.js index a354632c..4c876a82 100644 --- a/events/messageUpdate.js +++ b/events/messageUpdate.js @@ -5,6 +5,6 @@ module.exports = class { async run(oldMessage, newMessage) { if (!newMessage.editedAt) return; - this.client.emit("message", newMessage); + this.client.emit("messageCreate", newMessage); } }; \ No newline at end of file diff --git a/events/ready.js b/events/ready.js index d944a98a..ef69bb28 100644 --- a/events/ready.js +++ b/events/ready.js @@ -1,4 +1,5 @@ -const chalk = require("chalk"); +const chalk = require("chalk"), + { Permissions } = require("discord.js"); module.exports = class { constructor(client) { @@ -11,7 +12,7 @@ module.exports = class { // Logs some informations using logger client.logger.log(`Loading a total of ${client.commands.size} command(s).`, "log"); client.logger.log(`${client.user.tag}, ready to serve ${client.users.cache.size} users in ${client.guilds.cache.filter(guild => guild.id != "568120814776614924" && guild.id != "892727526911258654").size} servers.`, "ready"); - client.logger.log(`Invite Link: https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`, "ready"); + client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot"] , permissions: [Permissions.FLAGS.ADMINISTRATOR] })}`, "ready"); // Discord Together const discordtogether = require("../helpers/discordTogether"); diff --git a/helpers/autoUpdateDocs.js b/helpers/autoUpdateDocs.js index 126c3e0d..70479f65 100644 --- a/helpers/autoUpdateDocs.js +++ b/helpers/autoUpdateDocs.js @@ -15,8 +15,8 @@ module.exports = { let text = `# JaBa имеет свыше **${Math.floor(commands.size / 10)}0 команд** в **${categories.length} категориях**! \n\n#### Содержимое таблицы \n**Название**: Название команды \n**Описание**: Описание команды \n**Использование**: Использование команды ([] - обязательно, () - необязательно) \n**Откат**: Время, через которое команду можно будет использовать повторно\n\n`; // categories.sort(function(a, b) { - // const aCmdsLength = commands.filter((cmd) => cmd.help.category === a).array().length; - // const bCmdsLength = commands.filter((cmd) => cmd.help.category === b).array().length; + // const aCmdsLength = commands.filter((cmd) => cmd.help.category === a).size; + // const bCmdsLength = commands.filter((cmd) => cmd.help.category === b).size; // if (aCmdsLength > bCmdsLength) return -1; // else return 1; // }) @@ -24,7 +24,7 @@ module.exports = { const arrCat = [ ["Название", "Описание", "Использование", "Откат"] ]; - const cmds = commands.filter((cmd) => cmd.help.category === cat).array(); + const cmds = commands.filter((cmd) => cmd.help.category === cat); text += `### ${cat} (${cmds.length} ${client.getNoun(cmds.length, "команда", "команды", "команд")})\n\n`; cmds.sort(function (a, b) { if (a.help.name < b.help.name) return -1; diff --git a/helpers/birthdays.js b/helpers/birthdays.js index ab6dbb4a..badcde0e 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -27,18 +27,18 @@ async function init(client) { if (currentMonth === month && currentDay === day) { const embed = new Discord.MessageEmbed() - .setAuthor(client.user.username, client.user.displayAvatarURL({ + .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" - })) + })}) .setColor(client.config.embed.color) - .setFooter(client.config.embed.footer) + .setFooter({ text: client.config.embed.footer }) .addField(client.translate("economy/birthdate:HAPPY_BIRTHDAY"), client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { user: user.id, age: `${age} ${client.getNoun(age, message.translate("misc:NOUNS:AGE:1"), message.translate("misc:NOUNS:AGE:2"), message.translate("misc:NOUNS:AGE:5"))}` })); - const msg = await channel.send("@everyone", { embed }); + const msg = await channel.send({ content: "@here", embeds: [embed] }); await msg.react("🎉"); }; }; diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 312dcc14..fa2aa3e3 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -25,13 +25,13 @@ module.exports = { if (mustSent.length > 0) { mustSent.forEach((r) => { const embed = new Discord.MessageEmbed() - .setAuthor(client.translate("general/remindme:TITLE")) + .setAuthor({ name: client.translate("general/remindme:TITLE") }) .addField(client.translate("common:CREATION"), client.translate("general/remindme:CREATED", { time: client.convertTime(r.createdAt, "from") })) .addField(client.translate("common:MESSAGE"), r.message) .setColor(client.config.embed.color) - .setFooter(client.config.embed.footer); + .setFooter({ text: client.config.embed.footer }); dUser.send(embed); }); user.reminds = user.reminds.filter((r) => r.sendAt >= dateNow); diff --git a/helpers/checkUnmutes.js b/helpers/checkUnmutes.js index dc755be1..8f839f04 100644 --- a/helpers/checkUnmutes.js +++ b/helpers/checkUnmutes.js @@ -15,7 +15,7 @@ module.exports = { }); }); setInterval(async () => { - client.databaseCache.mutedUsers.array().filter((m) => m.mute.endDate <= Date.now()).forEach(async (memberData) => { + client.databaseCache.mutedUsers.filter((m) => m.mute.endDate <= Date.now()).forEach(async (memberData) => { const guild = client.guilds.cache.get(memberData.guildID); if (!guild) return; const member = guild.members.cache.get(memberData.id) || await guild.members.fetch(memberData.id).catch(() => { @@ -47,9 +47,9 @@ module.exports = { count: memberData.mute.case })) .setColor("#f44271") - .setFooter(guild.client.config.embed.footer); + .setFooter({ text: data.config.embed.footer }); const channel = guild.channels.cache.get(guildData.plugins.modlogs); - if (channel) channel.send(embed); + if (channel) channel.send({ embeds: [embed] }); memberData.mute = { muted: false, diff --git a/helpers/discordbots.org.js b/helpers/discordbots.org.js index 1df56d09..ed411d63 100644 --- a/helpers/discordbots.org.js +++ b/helpers/discordbots.org.js @@ -29,10 +29,12 @@ module.exports = { })).catch(() => {}); const logsChannel = client.channels.cache.get(client.config.votes.channel); - if (logsChannel) logsChannel.send(client.translate("misc:VOTE_LOGS", { - userid: dUser.id, - usertag: dUser.tag - })); + if (logsChannel) logsChannel.send({ + content: client.translate("misc:VOTE_LOGS", { + userid: dUser.id, + usertag: dUser.tag + }) + }); }); }; } diff --git a/helpers/extenders.js b/helpers/extenders.js index 1495706f..ebfbb2db 100644 --- a/helpers/extenders.js +++ b/helpers/extenders.js @@ -35,7 +35,7 @@ Message.prototype.sendT = function (key, args, options = {}) { if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`; if (options.edit) return this.edit(string); - else return this.channel.send(string); + else return this.channel.send({ content: string }); }; // Format a date @@ -48,7 +48,7 @@ Message.prototype.convertTime = function (time, type, noPrefix) { return this.client.convertTime(time, type, noPrefix, (this.guild && this.guild.data) ? this.guild.data.language : null); }; -Message.prototype.getNoun = function(number, one, two, five) { +Message.prototype.getNoun = function (number, one, two, five) { return this.client.getNoun(number, one, two, five); }; diff --git a/helpers/fortniteShop.js b/helpers/fortniteShop.js index 878c102a..ea51a14d 100644 --- a/helpers/fortniteShop.js +++ b/helpers/fortniteShop.js @@ -27,14 +27,13 @@ async function init(client) { .toAttachment(); const attachment = new Discord.MessageAttachment(image, "shop.png"); const embed = new Discord.MessageEmbed() - .setAuthor(client.translate("general/fortniteshop:DATE", { + .setAuthor({ name: client.translate("general/fortniteshop:DATE", { date: client.printDate(new Date(Date.now()), null, guildData.language) - }, guildData.language), client.user.displayAvatarURL()) - .attachFiles(attachment) + }, guildData.language), iconURL: client.user.displayAvatarURL()}) .setImage("attachment://shop.png") .setColor(client.config.embed.color) - .setFooter(client.config.embed.footer); - const msg = await fnChannel.send(embed); + .setFooter({ text: client.config.embed.footer }); + const msg = await fnChannel.send({ embeds: [embed] }); await msg.react("😍"); await msg.react("😐"); await msg.react("😭"); diff --git a/helpers/functions.js b/helpers/functions.js index 419e15e9..2aa67607 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -1,3 +1,4 @@ +const { Permissions } = require("discord.js"); const languages = require("../languages/language-meta.json").map((l) => l.moment).filter((l) => l !== "en"); languages.forEach((lang) => { require(`moment/locale/${lang}.js`); @@ -10,7 +11,7 @@ module.exports = { * @returns The prefix */ getPrefix(message, data) { - if (message.channel.type !== "dm") { + if (message.channel.type !== "DM") { const prefixes = [ `<@!${message.client.user.id}> `, `<@${message.client.user.id}> `, @@ -34,7 +35,7 @@ module.exports = { async supportLink(client) { const guild = client.guilds.cache.get(client.config.support.id); const member = guild.me; - const channel = guild.channels.cache.find((ch) => ch.permissionsFor(member.id).has("CREATE_INSTANT_INVITE") && ch.type === "text" || ch.type === "voice"); + const channel = guild.channels.cache.find((ch) => ch.permissionsFor(member.id).has(Permissions.FLAGS.CREATE_INSTANT_INVITE) && ch.type === "GUILD_TEXT" || ch.type === "GUILD_VOICE"); if (channel) { const invite = await channel.createInvite({ maxAge: 0 diff --git a/helpers/resolvers.js b/helpers/resolvers.js index e247db34..e826134e 100644 --- a/helpers/resolvers.js +++ b/helpers/resolvers.js @@ -4,8 +4,8 @@ const resolveChannel = async ({ message, search, channelType }) => { // Try by parsing the search if (contentToCheck.match(/^<#([0-9]{18})>/)) { - const [, channelID] = contentToCheck.match(/^<#([0-9]{18})>/); - const channelFound = message.guild.channels.cache.get(channelID); + const [, channelId] = contentToCheck.match(/^<#([0-9]{18})>/); + const channelFound = message.guild.channels.cache.get(channelId); if (channelFound && channelType && channelFound.type === channelType) return channelFound; }; @@ -30,8 +30,8 @@ const resolveMember = async ({ message, search, useMessageContent = true }) => { // Try by parsing the search if (contentToCheck.match(/^<@!?(\d+)>$/)) { - const [, userID] = contentToCheck.match(/^<@!?(\d+)>$/); - const memberFound = await message.guild.members.fetch(userID).catch(() => {}); + const [, userId] = contentToCheck.match(/^<@!?(\d+)>$/); + const memberFound = await message.guild.members.fetch(userId).catch(() => {}); if (memberFound) return memberFound; }; @@ -60,8 +60,8 @@ const resolveRole = async ({ message, search }) => { // Try by parsing the search if (contentToCheck.match(/^<@&([0-9]{18})>/)) { - const [, roleID] = contentToCheck.match(/^<@&([0-9]{18})>/); - const roleFound = message.guild.roles.cache.get(roleID); + const [, roleId] = contentToCheck.match(/^<@&([0-9]{18})>/); + const roleFound = message.guild.roles.cache.get(roleId); if (roleFound) return roleFound; }; diff --git a/index.js b/index.js index 7ca06901..7fe05f7d 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,8 @@ const Sentry = require("@sentry/node"), fs = require("fs"), readdir = util.promisify(fs.readdir), mongoose = require("mongoose"), - chalk = require("chalk"); + chalk = require("chalk"), + { Intents } = require("discord.js"); const config = require("./config"); if (config.apiKeys.sentryDSN) { @@ -20,8 +21,11 @@ if (config.apiKeys.sentryDSN) { }; // Load JaBa class -const JaBa = require("./base/JaBa"), - client = new JaBa(); +const JaBa = require("./base/JaBa"); +const client = new JaBa({ + intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_BANS, Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, Intents.FLAGS.GUILD_INVITES, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_MESSAGE_TYPING, Intents.FLAGS.DIRECT_MESSAGES], + partials: ["CHANNEL"] +}); const init = async () => { // Search for all commands diff --git a/languages/ru-RU/owner/eval.json b/languages/ru-RU/owner/eval.json index b20b1c2a..0e0b0507 100644 --- a/languages/ru-RU/owner/eval.json +++ b/languages/ru-RU/owner/eval.json @@ -1,5 +1,5 @@ { "DESCRIPTION": "Выполнить код!", "USAGE": "{{prefix}}eval [код]", - "EXAMPLES": "{{prefix}}eval message.channel.send(\"Hello World!\")" + "EXAMPLES": "{{prefix}}eval message.channel.send({ content: \"Hello World!\" })" } \ No newline at end of file diff --git a/package.json b/package.json index 0828af5a..3c867e37 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "author": "Jonny_Bro", "license": "ISC", "dependencies": { - "@discordjs/opus": "^0.5.0", + "@discordjs/voice": "^0.7.5", "@distube/soundcloud": "^1.0.0", "@distube/spotify": "^1.0.0", "@k3rn31p4nic/google-translate-api": "github:k3rn31p4nic/google-translate-api", @@ -32,11 +32,11 @@ "discord-backup": "^2.1.19", "discord-canvas": "^1.3.2", "discord-giveaways": "^4.4.3", - "discord-paginationembed": "^2.1.0", "discord-tictactoe": "^2.2.0", "discord-together": "^1.3.25", - "discord.js": "^12.5.3", - "distube": "^3.0.4", + "discord.js": "^13.5.0", + "discordjs-button-pagination": "^2.0.1", + "distube": "^3.0.5", "ejs": "^3.1.3", "express": "^4.17.1", "express-session": "^1.17.0",