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

Slash commands support #387

Open
ArnaudLier opened this issue Mar 31, 2021 · 5 comments
Open

Slash commands support #387

ArnaudLier opened this issue Mar 31, 2021 · 5 comments

Comments

@ArnaudLier
Copy link

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!'
    //     }
    //   }
    // })
  })```
@AFink
Copy link

AFink commented Apr 5, 2021

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
Copy link

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
Copy link

HugoFerrant commented May 17, 2021

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
Copy link

MrJesseh commented Nov 9, 2021

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

@dukeofsussex
Copy link
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants