2022-08-08 18:19:56 +05:00
|
|
|
const { SlashCommandBuilder, EmbedBuilder, ChannelType } = require("discord.js");
|
2022-08-04 19:26:17 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Serverinfo extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("serverinfo")
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDescription(client.translate("general/serverinfo:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
2023-07-05 00:58:06 +05:00
|
|
|
uk: client.translate("general/serverinfo:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false),
|
2022-08-04 19:26:17 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-04 19:26:17 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-08-04 19:26:17 +05:00
|
|
|
*/
|
2023-07-10 20:13:23 +05:00
|
|
|
async execute(client, interaction, data) {
|
2022-08-04 19:26:17 +05:00
|
|
|
const guild = interaction.guild;
|
|
|
|
|
|
|
|
await guild.members.fetch();
|
|
|
|
const owner = await guild.fetchOwner();
|
|
|
|
|
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setAuthor({
|
|
|
|
name: guild.name,
|
2022-12-15 21:02:38 +05:00
|
|
|
iconURL: guild.iconURL(),
|
2022-08-04 19:26:17 +05:00
|
|
|
})
|
|
|
|
.setThumbnail(guild.iconURL())
|
|
|
|
.addFields([
|
2023-08-20 14:05:51 +05:00
|
|
|
// {
|
|
|
|
// name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"),
|
|
|
|
// value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.domain}/stats/${guild.id})`,
|
|
|
|
// },
|
2022-08-04 19:26:17 +05:00
|
|
|
{
|
|
|
|
name: client.customEmojis.title + interaction.translate("common:NAME"),
|
|
|
|
value: guild.name,
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: client.customEmojis.calendar + interaction.translate("common:CREATION"),
|
2023-07-10 20:13:23 +05:00
|
|
|
value: client.functions.printDate(client, guild.createdAt, null, data.guildData.language),
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: client.customEmojis.users + interaction.translate("common:MEMBERS"),
|
2023-07-05 00:58:06 +05:00
|
|
|
value:
|
|
|
|
`${guild.members.cache.filter(m => !m.user.bot).size} ${client.functions.getNoun(
|
|
|
|
guild.members.cache.filter(m => !m.user.bot).size,
|
|
|
|
interaction.translate("misc:NOUNS:MEMBERS:1"),
|
|
|
|
interaction.translate("misc:NOUNS:MEMBERS:2"),
|
|
|
|
interaction.translate("misc:NOUNS:MEMBERS:5"),
|
|
|
|
)}` +
|
|
|
|
"\n" +
|
|
|
|
`${guild.members.cache.filter(m => m.user.bot).size} ${client.functions.getNoun(
|
|
|
|
guild.members.cache.filter(m => m.user.bot).size,
|
|
|
|
interaction.translate("misc:NOUNS:BOTS:1"),
|
|
|
|
interaction.translate("misc:NOUNS:BOTS:2"),
|
|
|
|
interaction.translate("misc:NOUNS:BOTS:5"),
|
|
|
|
)}`,
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"),
|
|
|
|
value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"),
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
2022-11-09 21:33:45 +05:00
|
|
|
name: client.customEmojis.id + interaction.translate("common:SERVER_ID"),
|
2022-08-04 19:26:17 +05:00
|
|
|
value: guild.id,
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: client.customEmojis.crown + interaction.translate("common:OWNER"),
|
|
|
|
value: owner.toString(),
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"),
|
|
|
|
value: guild.premiumSubscriptionCount?.toString() || "0",
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: client.customEmojis.channels + interaction.translate("common:CHANNELS"),
|
2023-07-05 00:58:06 +05:00
|
|
|
value:
|
|
|
|
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.functions.getNoun(
|
|
|
|
guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size,
|
|
|
|
interaction.translate("misc:NOUNS:TEXT:1"),
|
|
|
|
interaction.translate("misc:NOUNS:TEXT:2"),
|
|
|
|
interaction.translate("misc:NOUNS:TEXT:5"),
|
|
|
|
)}` +
|
|
|
|
"\n" +
|
|
|
|
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size} ${client.functions.getNoun(
|
|
|
|
guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size,
|
|
|
|
interaction.translate("misc:NOUNS:VOICE:1"),
|
|
|
|
interaction.translate("misc:NOUNS:VOICE:2"),
|
|
|
|
interaction.translate("misc:NOUNS:VOICE:5"),
|
|
|
|
)}` +
|
|
|
|
"\n" +
|
|
|
|
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${client.functions.getNoun(
|
|
|
|
guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size,
|
|
|
|
interaction.translate("misc:NOUNS:CATEGORY:1"),
|
|
|
|
interaction.translate("misc:NOUNS:CATEGORY:2"),
|
|
|
|
interaction.translate("misc:NOUNS:CATEGORY:5"),
|
|
|
|
)}`,
|
2022-12-15 21:02:38 +05:00
|
|
|
inline: true,
|
|
|
|
},
|
2022-08-04 19:26:17 +05:00
|
|
|
])
|
|
|
|
|
|
|
|
.setColor(client.config.embed.color)
|
2023-07-07 21:13:11 +05:00
|
|
|
.setFooter(client.config.embed.footer);
|
2022-08-04 19:26:17 +05:00
|
|
|
|
|
|
|
interaction.reply({
|
2022-12-15 21:02:38 +05:00
|
|
|
embeds: [embed],
|
2022-08-04 19:26:17 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Serverinfo;
|