JaBa/commands/General/serverinfo.js

62 lines
3.3 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Serverinfo extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "serverinfo",
dirname: __dirname,
enabled: true,
guildOnly: true,
2021-12-26 19:29:37 +05:00
aliases: ["si"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 1000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
let guild = message.guild;
if (args[0]) {
let found = this.client.guilds.cache.get(args[0]);
if (!found) {
2021-12-30 20:03:36 +05:00
found = this.client.guilds.cache.find(g => g.name.includes(args.join(" ")) || g.id === args[0]);
2021-12-10 21:39:54 +05:00
if (found) guild = found;
};
};
await guild.members.fetch();
const embed = new Discord.MessageEmbed()
2021-12-26 19:29:37 +05:00
.setAuthor(guild.name, guild.iconURL({
dynamic: true
}))
.setThumbnail(guild.iconURL({
dynamic: true
}))
2021-12-24 20:52:27 +05:00
.addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true)
.addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true)
2021-12-30 20:03:36 +05:00
.addField(this.client.customEmojis.users + message.translate("common:MEMBERS"),
`${guild.members.cache.filter(m => !m.user.bot).size} ${this.client.getNoun(guild.members.cache.filter(m => !m.user.bot).size, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}` +
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${this.client.getNoun(guild.members.cache.filter(m => m.user.bot).size, message.translate("misc:NOUNS:BOTS:1"), message.translate("misc:NOUNS:BOTS:2"), message.translate("misc:NOUNS:BOTS:5"))}`, true
)
2021-12-24 20:52:27 +05:00
.addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel || message.translate("general/serverinfo:NO_AFK_CHANNEL"), true)
.addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true)
.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)
2021-12-30 20:03:36 +05:00
.addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"),
`${guild.channels.cache.filter(c => c.type === "text").size} ${this.client.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} ${this.client.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"))}` +
2021-12-31 23:24:13 +05:00
"\n" + `${guild.channels.cache.filter(c => c.type === "category").size} ${this.client.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
2021-12-30 20:03:36 +05:00
)
2021-12-10 21:39:54 +05:00
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
message.channel.send(embed);
}
};
module.exports = Serverinfo;