Building slash commands differently
Hi, i had a discord bot on v13 and JS and i did this to implement slash commands
But i'm trying to do recreate this with TS and i don't seem to be able to do it this way,
Also : How should i manage to get this architecture with sub commands ?
I find this way easier to read so i'd like to keep it that way if possible
12 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!I mean if you dont want to use the discord.js way Im not sure its up to us to support it. Why doesnt this work?
It's not that it doesn't work, i just find this heavy and not really easy to read:
That's how i'm currently "supposed" to do with discord.js 14 (that's how it's done on the doc)
But i liked how it was done in v13
thats using builders but you dont have to
I can just do the first one and use it that way ?
But how about the sub commands then ? How can i include them ?
you can use raw objects as long as they match the format
Theyre just option types
Omg i'm gonna try that out, it would be game changer
Thanks a lot, i'm gonna try it and i'll come back to you !
Other question not directly related to the subjet,
So the previous bot i used had it's own commands but i cant delete them, any idea ?
I'm trying to do this :
But it still has the previous commands:
EDIT: nvm i'm deleteing them all one by one with the API it seems to work !
If you have duplicate commands on your server, you registered both global and guild commands.
You can remove the duplicates by resetting either the global or guild commands
- Resetting global commands:
rest.put(Routes.applicationCommands(clientId), { body: [] })
- Resetting guild commands: rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
yeah my bad sorry, but hey at least i fixed it ! And thanks for the help the issue is resolved