Subcommand & Subcommand Groups (Discord.js + DJS-Commander)
Vložit
- čas přidán 7. 09. 2024
- Subcommand & Subcommand Groups (Discord.js + DJS-Commander)
Previous Command Handler video: • Command + Event Handle...
How to Host your Discord bot: • How to Host your Disco...
Discord server: discord.underc...
DJS-Commander documentation: djs-commander....
Patreon: / underctrl
Buy me a coffee (one-time donation): buymeacoffee.c...
Thanks for watching :)
You said there’s no way of making it look nicer, but I don’t think that’s true. Since subcommand, options, and subcommand groups are all just callback functions, you could just define them in individual files within a subcommand, option, or subcommand group directory, importing them where necessary.
Furthermore, you can similarly implement the run() logic to conditionally run different functions imported from their respective subcommand files. You could even create a dynamic handler akin to the event and command handlers mentioned in the Discord.js docs that would get the interaction’s subcommand name, and then fetch a subcommand file based on its name.
😊If anyone wants to implement this, I think it would make your code much more organized and easier to manage, and I’d be happy to help.
importing multiple times like this is not very good for performance, I've read. also makes things more confusing if there's an error.
I didn't look if something like this existed, or if discord.js had it's own functionality for slash commands, so i ended up going through the pain of coding it myself 😭
Please make a video on how to make a Channel Generator for discord. (This is when a user joins a channel to create their own)
Hello. I made it through to the end. I get the message on discord properly after running the slash command. But, the role is not actually being added to the user.
The test user is the lowest roled in the server.
because it's not shown in the video
That command and subcommands in this video was just an example. It doesn't have any functionality other than replying to the person who executed the command.
I can’t register the command, I’m using DJS-commander
the option to add a user isn't showing for me
love it
What is the solution to this problem
There was an error: DiscordAPIError[10004]: Unknown Guild
It probably means the bot hasn't joined the specific server in which you're trying to register slash commands.
@@UnderCtrl Thank you very much ❣
Thanks
What extensions do you use on VSC?
・Theme: Dark+ V2 (Built-in)
・Font family: Fira Code
・Icons theme: Material Icon Pack (or something like that)
・Code formatter: Prettier
@@UnderCtrl and for the webpreview?