import SlashCommands from '../../Structure/SlashCommands.js'; import { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } from 'discord.js'; export default class extends SlashCommands { constructor(client) { super(client, { deferReply: true, //isPrivate: true, data: new SlashCommandBuilder() .setName('bans') .setDescription('〔👑 Moderação〕Exibe uma lista de todos os jogadores banidos.') //.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) <-- aparece apenas para usuários que tem a permissão administrador --> }); } run = async (interaction) => { const findUser = await this.mongo.get(`bandb.users`) if (findUser) { const usernames = findUser .filter(obj => obj !== null) const formattedStrings = usernames.map(obj => { const { username, reason, admin } = obj; return `Nome de Usuário: ${username} - Motivo: ${reason || 'Não informado'} - Administrador: ${admin}`; }); const result = formattedStrings.join('\n'); await interaction.editReply({ embeds: [ new EmbedBuilder() .setTitle('Jogadores Banidos') .setDescription(`${result}`) .setColor('#2ecc70') ] }) } else { await interaction.editReply({ embeds: [ new EmbedBuilder() .setTitle('Aviso') .setDescription('Não há jogadores banidos.') .setColor('#349cdc') ] }) } } }