const Discord = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('ban')
.setDescription('Отправляет ваш аватар/аватар упомянутого пользователя')
.addUserOption(option => option
.setName('banuser')
.setDescription('Выберите пользователя'))
.setRequired(true)
.addNumberOption(option => option
.setName('days')
.setDescription('Количество дней бана, от 0 до 7'))
.addStringOption(option => option
.setName('reason')
.setDescription('Укажите причину'))
.setRequired(true),
async execute(interaction) {
let bUser = interaction.options.getMember('banuser')
let reason = interaction.options.getString('reason')
let days = interaction.options.getNumber('days')
if(!bUser) return interaction.reply({content: 'Укажите пользователя, которого вы хотите забанить!', ephemeral: true})
if(bUser.id === interaction.user.id) interaction.reply({content: "Вы не можете забанить самого себя!", ephemeral: true});
if (!interaction.guild.me.permissions.has("BAN_MEMBERS")) return interaction.reply({content: "У меня нет прав!", ephemeral: true})
if (!interaction.member.permissions.has("BAN_MEMBERS")) return interaction.reply({content: "У вас нет прав!", ephemeral: true})
if (!reason) return interaction.reply({content: "Вы не указали причину!", ephemeral: true})
if (!days) days = 0
bUser.ban({reason: reason, days: days})
const ban_embed = new Discord.MessageEmbed()
.setColor('#db0f0f')
.addFields(
{ name: 'Пользователь', value: `<@${interaction.user.id}>` },
{ name: 'Забанил', value: `<@${bUser.id}>` },
{ name: 'По причине', value: reason }
);
interaction.reply({embeds: [ban_embed]})
},
};