Can I set different requiredUserPermissions for each subcommand?

Just wondering if this is possible, and how. Thanks
1 Reply
Favna
Favna2y ago
Subcommands don't have a precondition system and adding them would mean either completely overhauling both framework and subcommands and making subcommands a core feature, or making a completely separate subcommands precondition store, for the sake of separation of concerns. That all said, don't forget that preconditions are just glorified if checks. You can simply write:
if(!condition) {
throw new UserError(...)
}
if(!condition) {
throw new UserError(...)
}
Or even extract that to a function and just call the function. As the function will throw and that will bubble up you don't even need to if check or anything in the function. Once you have the error use the subcommand specific error events to handle it.
Want results from more Discord servers?
Add your server