interaction.options.getString returns null

Hi, in the snippet here, all I'm trying to do is get the bot to repeat what the user writes, however all that I'm getting returned is null. Could anyone give a hand as to what my problem is?
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('repeat')
.setDescription('repeats what you say'),
async execute(interaction) {
console.log(interaction.options.getString('said'));
const said = interaction.options.getString('said');
console.log(said);
await interaction.reply(said);
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('repeat')
.setDescription('repeats what you say'),
async execute(interaction) {
console.log(interaction.options.getString('said'));
const said = interaction.options.getString('said');
console.log(said);
await interaction.reply(said);
},
};
Thanks!
No description
4 Replies
d.js toolkit
d.js toolkit14mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Pukima
Pukima14mo ago
You cannot get the option, since there is no option made yet. In your slash command builder, add an option and make it required.
d.js docs
d.js docs14mo ago
guide Slash Commands: Parsing options read more
Myst
MystOP14mo ago
man i've read that page countless times, but always skipped that first part for some reason thank you though, you're completely right!
Want results from more Discord servers?
Add your server