discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.32k stars 3.97k forks source link

How do i get the value that the user has input in an option of a command? #6813

Closed hemfreitas11 closed 2 years ago

hemfreitas11 commented 2 years ago

Issue description

Before discord.js implemented slash commands I used the DiscordAPI for this feature, and the way I retrieved the value of an option was interaction.data.options[0].value to get the value of the first option of the command for example. But now that I'm using discord.js for this, I can't seem to figure out how to get the value that the user has set for the option. image

Code sample

No response

discord.js version

discord.js@13.2.0

Node.js version

v16.11.0

Operating system

Windows 11

Priority this issue should have

Low (slightly annoying)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

GUILDS, GUILD_MESSAGES

I have tested this issue on a development release

bfb89de

monbrey commented 2 years ago

The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.

almostSouji commented 2 years ago

For future search purposes: Here is a guide on slash commands: https://discordjs.guide/interactions/replying-to-slash-commands.html#parsing-options