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
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 commentedon 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 commentedon Apr 8, 2021
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 commentedon 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 commentedon Nov 9, 2021
Would be nice to see slash command support with commando for sure.
dukeofsussex commentedon Nov 9, 2021
Try https://github.com/Snazzah/slash-create, inspired by Commando.