const { SlashCommandBuilder } = require('discord.js');
const { client } = require('./config');
module.exports = {
data: new SlashCommandBuilder()
.setName('dban')
.setDescription('Bans a user from all servers the bot is in.')
.addParam('user', {
description: 'The user to ban.',
type: 'user',
})
.addParam('reason', {
description: 'The reason for the ban',
type: 'string',
})
.addParam('duration', {
description: 'The duration of the ban, in minutes',
type: 'integer',
})
await execute(interaction) {
const user = interaction.options.user;
const reason = interaction.options.reason;
const duration = interaction.options.duration;
const allowedUsers = require('./config.json').allowedUsers;
if (!allowedUsers.includes(interaction.user.id)) {
await interaction.reply('You are not authorized to use this command.');
return;
}
const guilds = client.guilds.cache;
for (const guild of guilds) {
guild.ban(user, { reason });
}
await interaction.reply(`Successfully banned ${user} from all of the servers. Reason: **${reason}**. Duration: **${duration} minutes.**`);
}