2024-02-06 21:45:53 +05:00
|
|
|
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
|
2022-08-04 19:26:17 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Staff extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../base/Client")} client
|
2022-08-04 19:26:17 +05:00
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("staff")
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDescription(client.translate("general/staff:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
2023-07-05 00:58:06 +05:00
|
|
|
uk: client.translate("general/staff:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("general/staff: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
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-04 19:26:17 +05:00
|
|
|
});
|
|
|
|
}
|
2024-02-06 21:45:53 +05:00
|
|
|
|
2022-08-04 19:26:17 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-04 19:26:17 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
|
|
|
await interaction.guild.members.fetch();
|
2023-10-30 21:13:12 +05:00
|
|
|
|
2023-02-01 00:23:01 +05:00
|
|
|
const administrators = interaction.guild.members.cache.filter(m => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot);
|
|
|
|
const moderators = interaction.guild.members.cache.filter(m => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot);
|
2024-02-06 21:45:53 +05:00
|
|
|
|
|
|
|
const embed = client.embed({
|
|
|
|
author: {
|
2022-08-04 19:26:17 +05:00
|
|
|
name: interaction.translate("general/staff:TITLE", {
|
2022-12-15 21:02:38 +05:00
|
|
|
guild: interaction.guild.name,
|
|
|
|
}),
|
2024-02-06 21:45:53 +05:00
|
|
|
iconURL: interaction.guild.iconURL(),
|
|
|
|
},
|
|
|
|
fields: [
|
2022-08-04 19:26:17 +05:00
|
|
|
{
|
|
|
|
name: interaction.translate("general/staff:ADMINS"),
|
2023-07-05 00:58:06 +05:00
|
|
|
value:
|
|
|
|
administrators.size > 0
|
|
|
|
? administrators.map(a => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n")
|
|
|
|
: interaction.translate("general/staff:NO_ADMINS"),
|
2022-08-04 19:26:17 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("general/staff:MODS"),
|
2023-07-05 00:58:06 +05:00
|
|
|
value: moderators.size > 0 ? moderators.map(m => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS"),
|
2022-12-15 21:02:38 +05:00
|
|
|
},
|
2024-02-06 21:45:53 +05:00
|
|
|
],
|
|
|
|
});
|
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 = Staff;
|