> For the complete documentation index, see [llms.txt](https://slashcommands.mxgnus.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://slashcommands.mxgnus.de/create-slashcommands/guild-slashcommand-with-options-and-choices.md).

# Guild slashcommand with options and choices

```javascript
const {
   GuildSlashCommand,
   Slash,
   SlashcommandOption,
   SlashCommandOptionChoice,
} = require('@mxgnus/slashcommands.js');

new Slash(bot /* your discord.js client */); // initialize the slash command

const nameChoice1 = new SlashCommandOptionChoice()
   .setName('name1')
   .setValue('Name 1');
const nameChoice2 = new SlashCommandOptionChoice()
   .setName('name2')
   .setValue('Name 2');
const nameOption = new SlashcommandOption()
   .setName('name')
   .setDescription('Name')
   .setType('STRING')
   .setRequired(true)
   .setChoices([nameChoice1, nameChoice2]);

new GuildSlashCommand()
   .setGuildId('your guild id')
   .setName('name')
   .setDescription('Enter your name')
   .addOption(nameOption)
   .register();
```
