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

Slash commands support #387

Open
Open
@ArnaudLier

Description

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

AFink

AFink commented on Apr 5, 2021

@AFink

That looks very nice :D, I think Commando will wait to implement this until the main lib has it integrated..
Anyway, you know a way to run the commando- commands in the INTERACTION_CREATE-event and return the message as a slash command callback?

thomasthebro1

thomasthebro1 commented on Apr 8, 2021

@thomasthebro1

I definitely like the idea of this suggestion. Slash command support will add to Commando's wide range of fantastic features that it already has.

HugoFerrant

HugoFerrant commented on May 17, 2021

@HugoFerrant

discordjs/discord.js has Slash Commands merged ! See this issue discordjs/discord.js#5103 and the related PR discordjs/discord.js#5448 🚀
Looking forward to see this in Commando, sending some love to maintainer here (because there is no Sponsor link)!

MrJesseh

MrJesseh commented on Nov 9, 2021

@MrJesseh

Would be nice to see slash command support with commando for sure.

dukeofsussex

dukeofsussex commented on Nov 9, 2021

@dukeofsussex
Contributor

Would be nice to see slash command support with commando for sure.

Try https://github.com/Snazzah/slash-create, inspired by Commando.

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

      Participants

      @dukeofsussex@HugoFerrant@lilyissillyyy@ArnaudLier@MrJesseh

      Issue actions

        Slash commands support · Issue #387 · discordjs/Commando