Мелкие правки

Фиксы в slist
This commit is contained in:
JonnyBro 2022-02-24 02:04:35 +05:00
parent 89f76d36e5
commit cb29f37cb9
3 changed files with 18 additions and 22 deletions

View file

@ -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");
@ -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)}`)
.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);
});
}

View file

@ -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]
});

View file

@ -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]
});