How to detect which choice is selected?

Hello, I have 4 choices in my command:
.addStringOption(option =>
option.setName('type')
.setDescription('The gif type')
.setRequired(true)
.addChoices(
{ name: 'Bite', value: 'gif_bite' },
{ name: 'Hug', value: 'gif_hug' },
{ name: 'Bite', value: 'gif_bite' },
)),
.addStringOption(option =>
option.setName('type')
.setDescription('The gif type')
.setRequired(true)
.addChoices(
{ name: 'Bite', value: 'gif_bite' },
{ name: 'Hug', value: 'gif_hug' },
{ name: 'Bite', value: 'gif_bite' },
)),
How can I get which choice is selected?
const chosenString1 = interaction.options.getString("gif_bite")
const chosenString1 = interaction.options.getString("gif_bite")
I have tried this but it didn't work!
4 Replies
d.js docs
d.js docs3y 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.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Pooyan
PooyanOP3y ago
thanks it worked!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server