Search code examples
inputdiscord.jscommandslash

Discord.js: Add input field to slash command


Example

Hey guys, can anyone tell me how to add such an input field to a slash command in Discord.js (v.14)? Example above.


Solution

  • Look at the discord.js doc here
    When you create a command, you have just to set the options parameters :

    client.application.commands.create({
        type: "CHAT_INPUT",
        name: "mycommand",
        description: "My awesome command",
        options: [
            {
                type: "STRING",
                name: "firstparameter",
                description: "My first parameter",
                required: true
            }
        ]
    });