import SlashCommands from '../../Structure/SlashCommands.js'; import { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } from 'discord.js'; import Roblox from '../../Utils/Classes/getData.js'; const data = new Roblox() export default class extends SlashCommands { constructor(client) { super(client, { deferReply: true, //isPrivate: true, data: new SlashCommandBuilder() .setName('ban') .setDescription('〔👑 Moderação〕Bane um jogador do servidor do Roblox.') //.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) <-- aparece apenas para usuários que tem a permissão administrador --> .addStringOption(option => option.setName("identifier") .setDescription("〔👑 Moderação〕Qual o usuário que será banido?") .setRequired(true) ) .addStringOption(option => option.setName("motivo") .setDescription("〔👑 Moderação〕Qual o motivo do banimento?") .setRequired(true) ) }); } run = async (interaction) => { const search = interaction.options.getString("identifier") try { const str = interaction.options.getString("motivo") const user = await data.getUserIdByUsername(search) const findUser = await this.mongo.get(`banthis.mongo.users.${user.id}`) if (!findUser) { const embed = new EmbedBuilder() .setColor('#2ecc70') .setTitle('Jogador Banido') .setDescription(`**Nome de Exibição**\n${user.name}\n**Nome de Usuário**\n${user.displayName}\n**ID**\n${user.id}\n**Motivo**\n${str}\n**Administrador**\n${interaction.user.username} `) await this.mongo.set(`bandb.users.${user.id}`, { userid: user.id, username: user.name, reason: str, admin: interaction.user.username }) await interaction.editReply({ embeds: [embed] }) return; } else { await interaction.editReply({ embeds: [ new EmbedBuilder() .setTitle('Aviso') .setColor('#349cdc') .setDescription(`O usuário \`${user.id}\` já esta banido.`) ] }) return; } } catch(err) { await interaction.editReply({ embeds: [ new EmbedBuilder() .setTitle('Erro') .setColor('#db523f') .setDescription(`O usuário \`${search}\` não existe.`) ] }) return; } } }