discord-slash-command
TypeScript icon, indicating that this package has built-in type declarations

1.2.5 • Public • Published

Discord Slash Command

Install

npm i discord-slash-command

Usage

import { ApplicationCommandOptionType, builder } from 'discord-slash-command';
const command = builder('cmd')
    .defaultPermission(true)
    .description('foo')
    .options(options => {
        return options
            .option(option => {
                return option
                    .type(ApplicationCommandOptionType.SUB_COMMAND)
                    .name('foo')
                    .description('bar')
                    .choices(choices => {
                        return choices
                            .choice(choice => {
                                return choice
                                    .name('choice1')
                                    .value('choice1');
                            });
                    });
            });
    })
    .command;
/*
 * output
 *
 * {
 *     "name": "cmd",
 *     "description": "foo",
 *     "options": [
 *         {
 *             "type": 1,
 *             "name": "foo",
 *             "description": "bar",
 *             "choices": [
 *                 {
 *                     "name": "choice1",
 *                     "value": "choice1"
 *                 }
 *             ]
 *         }
 *     ],
 *     "default_permission": true
 * }
 */

Package Sidebar

Install

npm i discord-slash-command

Weekly Downloads

15

Version

1.2.5

License

MIT

Unpacked Size

33.1 kB

Total Files

13

Last publish

Collaborators

  • sharo-jef