Options is not working for me

I'm trying to create a command that has options, but discord does not want to offer to fill them.
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Replies with your input!')
.addStringOption(option =>
option.setName('input')
.setDescription('The input to echo back')
.setRequired(true)
),
async execute(interaction) {
// Always null
const answer = interaction.options.getString('echo')
return interaction.reply({content: `Your input: ${answer}`, ephemeral: true})
}
}
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Replies with your input!')
.addStringOption(option =>
option.setName('input')
.setDescription('The input to echo back')
.setRequired(true)
),
async execute(interaction) {
// Always null
const answer = interaction.options.getString('echo')
return interaction.reply({content: `Your input: ${answer}`, ephemeral: true})
}
}
Wildly apologize if somewhere already asked this, because I could not find
5 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
chewie
chewie3y ago
sounds like you registered the command without options and didn't re-register them after adding options
miawue
miawueOP3y ago
oh, mb i get u, u mean i need to add options and here too, right?
miawue
miawueOP3y ago
this file deploys commands to discord
chewie
chewie3y ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Want results from more Discord servers?
Add your server