Skip to content
This repository was archived by the owner on Dec 24, 2021. It is now read-only.
This repository was archived by the owner on Dec 24, 2021. It is now read-only.

Slash commands support #387

Description

@ArnaudLier

It would be cool to integrate Slash commands support in Commando: https://discord.com/developers/docs/interactions/slash-commands.
It can be done with something like this:

  client.registry.commands.forEach(command => {
    client.api.applications(client.user.id).guilds('GUILD ID').commands.post({
      data: {
        name: command.name.replace(/-/g, ''),
        description: command.description,
        options: command.argsCollector?.args.map(arg => ({
          name: arg.label.replace(/[\s/]/g, '-'),
          description: arg.prompt,
          type: getDiscordType(arg.type?.id),
          required: typeof arg.default === 'undefined',
        }))
      }
    })
  })

  client.ws.on('INTERACTION_CREATE', async interaction => {
    // console.log(interaction)
    // client.api.interactions(interaction.id, interaction.token).callback.post({
    //   data: {
    //     type: 4,
    //     data: {
    //       content: 'Hello world!'
    //     }
    //   }
    // })
  })```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions