slashcommand input issue

Why isn't this working?
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('hxbuy')
.setDescription('This is used by the administration when a user have bought Hx Cheats')
.addStringOption(option =>
option.setName('Key')
.setDescription('The Hx Cheats key it will provide the customer with (Lifetime / Month / Week / 1day)')
.setRequired(true)),
async execute(interaction, client) {
const Key = interaction.options.getString('Key') ?? 'No key was provided!';

interaction.reply('Test123' + (Key))

}
}
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('hxbuy')
.setDescription('This is used by the administration when a user have bought Hx Cheats')
.addStringOption(option =>
option.setName('Key')
.setDescription('The Hx Cheats key it will provide the customer with (Lifetime / Month / Week / 1day)')
.setRequired(true)),
async execute(interaction, client) {
const Key = interaction.options.getString('Key') ?? 'No key was provided!';

interaction.reply('Test123' + (Key))

}
}
https://media.discordapp.net/attachments/1092217188045299794/1093180829485776946/image.png
3 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Pulse
Pulse2y ago
option name cannot be capitalized, should be key instead
Pulse
Pulse2y 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