nyx/command/Owner/guilds.js
2022-01-22 18:46:16 +05:30

50 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { MessageEmbed } = require("discord.js");
module.exports = {
name: "guilds",
category: "Owner",
description: "Check top 10 guilds of the bot",
Owner: true,
run: async (client, interaction) => {
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`;
})
.join("\n");
const embed = new MessageEmbed()
.setTitle("Guilds")
.setDescription(description)
.addFields(
{
name: `Total Guilds`,
value: client.guilds.cache.size,
inline: true
},
{
name: `Total Members`,
value: client.users.cache.size,
inline: true
}
)
.setColor(client.color)
.addFields(
{
name: `Total Guilds`,
value: client.guilds.cache.size,
inline: true,
},
{
name: `Total Members`,
value: client.users.cache.size,
inline: true,
}
)
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
.setTimestamp();
interaction.followUp({ embeds: [embed] });
},
};