Is there anyway using Subcommand plugin with Slash command
Seem like
chatInputRun
is not exist on SubCommand11 Replies
because you're not supposed to implement it
SubCommand implements chatInputRun and overriding it disables the subcommand parsing
you're supposed to only implement the subcommands
You can refer my subcommands here for clarity https://github.com/MRDGH2821/Perpetual-Mechanical-Array-Bot/tree/main/src/baseBot/commands
why not use slash command builders?
Builders would consume more memory.
So I'm avoiding builders wherever possible.
What sort of environment are you running in where a class instance that would get GC'd takes a significant amount memory vs the object it returns?
If you're trying to run code in like.. 50MiB of memory I could understand that, but I truely doubt that (+ JS wouldn't be the best choice)
This solve my question
Adding to this if the validation checks are a concern they can be disabled, but even then shapeshift is blazingly fast anyway.
Uhh this is gonna go out of scope of this question.
I have put my 3 bots in a their own docker container. Hosted on VM of 1 vCPU & 2GB RAM.
As for why no builders (in general, not just slash command builders)
- Builders would ultimately return an JS/JSON object, so why not directly define JS/JSON object myself?
Builders are good for beginners, but now I'm making 3.x.x/4.x.x version of my bot, so I would definitely use some optimizations here & there
- Makes that part of code portable across library & language
My bots use builders and run in a container with 1 vCPU and 256 MiB RAM. That's not really a huge bottleneck unless your bot is large.
Builders make your code more readable and can add validation checks and better strict typing.
The optimization of using builders is likely not noticable.
Builders exist in almost every language, and most have even better ways of doing this directly in the type system, like Rust:
Builders also make your code easier to maintain, as it abstracts changes made by discord away from you and to the libary (discord.js, in this case)