nyx/command/Owner/guilds.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-10-26 12:38:28 +02:00
const { EmbedBuilder } = require("discord.js");
2021-09-06 12:38:25 +02:00
module.exports = {
name: "guilds",
category: "Owner",
description: "Check top 10 guilds of the bot",
Owner: true,
run: async (client, interaction) => {
2021-09-06 12:38:25 +02:00
const guilds = client.guilds.cache
.sort((a, b) => b.memberCount - a.memberCount)
.first(10);
const description = guilds
.map((guild, index) => {
return `**${index + 1}** ${guild.name} = ${
guild.memberCount
} members`;
2021-09-06 12:38:25 +02:00
})
.join("\n");
2022-10-26 12:38:28 +02:00
const embed = new EmbedBuilder()
2021-09-06 12:38:25 +02:00
.setTitle("Guilds")
.setDescription(description)
.setColor(client.color)
2023-04-02 14:12:53 +02:00
.addFields([
2022-01-15 22:35:02 +01:00
{
name: `Total Guilds`,
2023-04-02 14:12:53 +02:00
value: client.guilds.cache.size
? client.guilds.cache.size.toString()
: "0",
2022-01-15 22:35:02 +01:00
inline: true,
},
{
name: `Total Members`,
2023-04-02 14:12:53 +02:00
value: client.users.cache.size
? client.users.cache.size.toString()
: "0",
2022-01-15 22:35:02 +01:00
inline: true,
2023-04-02 14:12:53 +02:00
},
])
2022-10-26 12:38:28 +02:00
.setFooter({
text: `Made by ${client.author}`,
2023-04-02 14:12:53 +02:00
iconURL: client.user.displayAvatarURL({ dynamic: true }),
2022-10-26 12:38:28 +02:00
})
2021-09-06 12:38:25 +02:00
.setTimestamp();
interaction.followUp({ embeds: [embed] });
},
};