From cb29f37cb904fe1592d191f93575d839f18eb9e5 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Thu, 24 Feb 2022 02:04:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=A4=D0=B8=D0=BA=D1=81=D1=8B?= =?UTF-8?q?=20=D0=B2=20slist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Owner/servers-list.js | 36 +++++++++++++++------------------- events/guildCreate.js | 2 +- events/guildDelete.js | 2 +- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/commands/Owner/servers-list.js b/commands/Owner/servers-list.js index 5a6a7701..ded1680c 100644 --- a/commands/Owner/servers-list.js +++ b/commands/Owner/servers-list.js @@ -23,8 +23,10 @@ class ServersList extends Command { page = 1; let description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).map((r) => r) - .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`) + this.client.guilds.cache + .sort((a, b) => b.memberCount - a.memberCount) + .map((r) => r) + .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.getNoun(r.memberCount, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}`) .slice(0, 10) .join("\n"); @@ -41,7 +43,7 @@ class ServersList extends Command { .setFooter({ text: this.client.user.username }) - .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.ceil(this.client.guilds.cache.size/10)}`) + .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.ceil(this.client.guilds.cache.size / 10)}`) .setDescription(description); const msg = await message.reply({ @@ -62,55 +64,50 @@ class ServersList extends Command { }); collector.on("collect", async (reaction) => { - if (message.channel.type === "DM") return; - if (reaction._emoji.name === "⬅") { - // Updates variables i0 = i0 - 10; i1 = i1 - 10; page = page - 1; - // if there is no guild to display, delete the message if (i0 < 0) return msg.delete(); if (!i0 || !i1) return msg.delete(); description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).map((r) => r) - .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS")}`) + this.client.guilds.cache + .sort((a, b) => b.memberCount - a.memberCount) + .map((r) => r) + .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.getNoun(r.memberCount, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}`) .slice(i0, i1) .join("\n"); - // Update the embed with new informations - embed.setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.round(this.client.guilds.cache.size/10)}`) + embed + .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.round(this.client.guilds.cache.size / 10)}`) .setDescription(description); - // Edit the message msg.edit({ embeds: [embed] }); } if (reaction._emoji.name === "➡") { - // Updates variables i0 = i0 + 10; i1 = i1 + 10; page = page + 1; - // if there is no guild to display, delete the message if (i1 > this.client.guilds.cache.size + 10) return msg.delete(); if (!i0 || !i1) return msg.delete(); description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache.sort((a, b) => b.memberCount - a.memberCount).map((r) => r) - .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`) + this.client.guilds.cache + .sort((a, b) => b.memberCount - a.memberCount) + .map((r) => r) + .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.getNoun(r.memberCount, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}`) .slice(i0, i1) .join("\n"); - // Update the embed with new informations - embed.setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.round(this.client.guilds.cache.size/10)}`) + embed.setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.round(this.client.guilds.cache.size / 10)}`) .setDescription(description); - // Edit the message msg.edit({ embeds: [embed] }); @@ -118,7 +115,6 @@ class ServersList extends Command { if (reaction._emoji.name === "❌") return msg.delete(); - // Remove the reaction when the user react to the message await reaction.users.remove(message.author.id); }); } diff --git a/events/guildCreate.js b/events/guildCreate.js index b2759e2c..00b6bce1 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -49,7 +49,7 @@ module.exports = class { }) }) .setColor("#32CD32") - .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:MEMBERS:1"), this.client.translate("misc:NOUNS:MEMBERS:2"), this.client.translate("misc:NOUNS:MEMBERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); + .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:USERS:1"), this.client.translate("misc:NOUNS:USERS:2"), this.client.translate("misc:NOUNS:USERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); this.client.channels.cache.get(this.client.config.support.logs).send({ embeds: [embed] }); diff --git a/events/guildDelete.js b/events/guildDelete.js index bcf870f0..63997e60 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -17,7 +17,7 @@ module.exports = class { }) }) .setColor("#B22222") - .setDescription(`Вышел с сервера **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:MEMBERS:1"), this.client.translate("misc:NOUNS:MEMBERS:2"), this.client.translate("misc:NOUNS:MEMBERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); + .setDescription(`Вышел с сервера **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:USERS:1"), this.client.translate("misc:NOUNS:USERS:2"), this.client.translate("misc:NOUNS:USERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); this.client.channels.cache.get(this.client.config.support.logs).send({ embeds: [embed] });