Added debug command

This commit is contained in:
2023-05-19 20:58:57 +02:00
parent 80b33f2b34
commit 9a7bc7e089

75
commands-testing/debug.js Normal file
View File

@@ -0,0 +1,75 @@
const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require('discord.js');
const { color } = require('../config/options.json');
module.exports = {
name: 'debug',
description: 'Debug command for the bot.',
type: 'slash',
data: new SlashCommandBuilder()
.setName('debug')
.setDescription('Debug command for the bot.')
.addUserOption(option =>
option
.setName('user')
.setDescription('User to debug.'))
.addChannelOption(option =>
option
.setName('channel')
.setDescription('Channel to debug.'))
.addRoleOption(option =>
option
.setName('role')
.setDescription('Role to debug.'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.setDMPermission(false),
async execute(interaction) {
const user = interaction.options.getUser('user');
const channel = interaction.options.getChannel('channel');
const role = interaction.options.getRole('role');
const embedColor = Number(color.replace('#', '0x'))
if (!user) {
var userEmbed = new EmbedBuilder()
.setTitle('User')
.setDescription("No user provided.")
.color(embedColor)
} else {
var userEmbed = new EmbedBuilder()
.setTitle('User')
.setDescription(user)
.color(embedColor)
}
if (!channel) {
var channelEmbed = new EmbedBuilder()
.setTitle('Channel')
.setDescription("No channel provided.")
.color(embedColor)
} else {
var channelEmbed = new EmbedBuilder()
.setTitle('Channel')
.setDescription(channel)
.color(embedColor)
}
if (!role) {
var roleEmbed = new EmbedBuilder()
.setTitle('Role')
.setDescription("No role provided.")
.color(embedColor)
} else {
var roleEmbed = new EmbedBuilder()
.setTitle('Role')
.setDescription(role)
.color(embedColor)
}
await interaction.reply({
embeds: [userEmbed, channelEmbed, roleEmbed],
});
}
}