Dynamic subcommand methods

Hey, i am creating some subcommands that basically have the same runner method, but i would wanna know which subcommand is being ran on that runner method, so i looked at the docs and i found the message context but it only returns commandName and not the subcommand or the group.
No description
Solution:
well i have multiple subcommands that follow the same logic, but they are all different entities. and so instead of creating multiple methods and assigning them i would like to attach a single method to all of them since they follow the same logic, except they make the database entry according to which subcmd was ran, i know i can use a utility method to just override all of the extra methods i can create, but i don't wanna do that it would be better if i can just attach one single method and ge...
Jump to solution
4 Replies
Favna
Favna11mo ago
So I can give you a better answer, what exactly do you need that for? Like what is the endgoal?
Solution
Xeno
Xeno11mo ago
well i have multiple subcommands that follow the same logic, but they are all different entities. and so instead of creating multiple methods and assigning them i would like to attach a single method to all of them since they follow the same logic, except they make the database entry according to which subcmd was ran, i know i can use a utility method to just override all of the extra methods i can create, but i don't wanna do that it would be better if i can just attach one single method and get it through params
Favna
Favna11mo ago
Alright well that isn't possible because the args that hold the subcommand are skipped prior to running the subcommand. If it just for logging then it is emitted but your use case is not just logging.
Favna
Favna11mo ago
marked your own reply as the solution because you already laid it out for yourself there btw your end goal is possible with application commands, just not message commands but that probably doesnt help much
Want results from more Discord servers?
Add your server