module.exports = {
data: new SlashCommandBuilder()
.setName('ticket-setup')
.setDescription('Sets up the Ticket System for the server.')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addRoleOption(option =>
option.setName('role')
.setDescription('Role to mention in the ticket (Staff Role)')
.setRequired(true))
.addChannelOption(option =>
option.setName('category')
.setDescription('Category where the ticket channels will be created')
.setRequired(true)
.addChannelTypes(4) // GuildCategory
),
async run(interaction) {
const role = interaction.options.getRole('role');
const category = interaction.options.getChannel('category');
#Learning to code on my own.... Need some help with error handles
1 messages · Page 1 of 1 (latest)
interaction.options is undefined. Perhaps the code that calls that method does not check if the interaction is a command?
In this scenario where woul you look to try and solve this issue?
here in my setup command
I dont think the issue is with your command itself. Rather with your command handler. Could you share that?
// Initialize CommandHandler with client instance
new CommandHandler({
client,
commandsPath: path.join(__dirname, 'commands'),
eventsPath: path.join(__dirname, 'events'),
//testServer: 'TEST_SERVER_ID', // Replace with your server ID for guild-based commands (optional)
});
that is in my index.js file
Did you create that command handler?
no sir
Which one are you using
what do you mean if you dont mind me asking?
What command handler did you Install
"djs-commander": "^0.0.50",
2s
Okay first of all its deprecated meaning it no longer receives updates.
Other than that your run method is wrong.
It should be something along
async run: ({ interaction, client, handler }) => {
// your code here
}
According to what I found Here