#interaction.options.getString return NULL

14 messages · Page 1 of 1 (latest)

steel vale
#

Hi !

I have a question, when I do :

...

data: new SlashCommandBuilder()
        .setName('presentation')
        .setDescription('Provides information about the user.')
        .addStringOption(option =>
            option.setName('pseudo')
                .setRequired(true))

...

const pseudo = interaction.options.getString('pseudo');

pseudo return null and i don't know why.

Did someone have an idea ? Thanks in advance 🙏

fringe flare
#

• 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.

cinder ridge
#

Pass true as a second argument to .getString if the option is required

fringe flare
#

that shouldnt change anything

steel vale
#
TypeError [CommandInteractionOptionNotFound]: Required option "pseudo" not found.
    at CommandInteractionOptionResolver.get (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/structures/CommandInteractionOptionResolver.js:78:15)
    at CommandInteractionOptionResolver._getTypedOption (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/structures/CommandInteractionOptionResolver.js:95:25)
    at CommandInteractionOptionResolver.getString (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/structures/CommandInteractionOptionResolver.js:160:25)
    at Object.execute (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/commands/presentation.js:158:44)
    at Client.<anonymous> (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/index.js:30:17)
    at Client.emit (node:events:513:28)
    at InteractionCreateAction.handle (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
    at module.exports [as INTERACTION_CREATE] (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/client/websocket/WebSocketManager.js:352:31)
    at WebSocketShard.onPacket (/Users/piotezaza/Documents/Développement/Projets/discordBot_DarksDemon/node_modules/discord.js/src/client/websocket/WebSocketShard.js:480:22) {
  code: 'CommandInteractionOptionNotFound'
}
steady cosmos
#

the slash command option you run doesn't have "pseudo" as option specified in it. If u say it does, no it doesn't

steel vale
#

There ?

#

wjifjweipfjwpeofjpwef

#

It's "nom"

steady cosmos
#

bruh

steel vale
#

😭

fringe flare
steel vale
#

Thanks, 1 hour lost sad