Search code examples
discord.js

Discord.js - Getting additional Text from Slash Command


When writing a Discord.js Slash Command, is it possible to get the text that was entered "outside" of the defined options?

Let's say I have the following SlashCommand defined:

new SlashCommandBuilder()
        .setName('slashtest')
        .addStringOption(option => option.setName('name').setDescription('Test Option').setRequired(true))
        .addStringOption(option => option.setName('text').setDescription('Second Option').setRequired(true)),

In this example I would like to get the text "Even more Stuff" Example Image


Solution

  • According to the discord.js documentation and the discord developer documentation, you can only get user input from the command options in the discord slash command 'handler' (the menu that pops up when you enter '/').

    From my past experience of using slash commands, I don't believe it's possible to retrieve user input outside of options. I guess you could create more options for more specific user input.