How do I apply preconditions to a specific subcommand
I’d like to only apply my
OwnerOnly
precondition to certain sub commands instead of all of them. Is there a way to do this?Solution:Jump to solution
It is not supported and unless someone makes a PR to the plugin it likely won't be. What you can do is extract the code of the ownerOnly check to a function then import that in both places because ultimately preconditions are just glorified if checks
9 Replies
Solution
It is not supported and unless someone makes a PR to the plugin it likely won't be. What you can do is extract the code of the ownerOnly check to a function then import that in both places because ultimately preconditions are just glorified if checks
npm
@kaname-png/plugin-subcommands-advanced
Plugin for @sapphire/framework to be able to create subcommands based on command classes.. Latest version: 2.1.6, last published: 4 days ago. Start using @kaname-png/plugin-subcommands-advanced in your project by running
npm i @kaname-png/plugin-subcommands-advanced
. There are no other projects in the npm registry using @kaname-png/plugin-subc...oh I wasnt sure if that was in your variant or not
good to know
@Rhys is it possible to change the AnswerOverflow solution message? I tried it through the apps menu just now on Kaname's message but that didn't seem to have worked.
Like changing which message was selected to be the solution?
Currently that's not supported - I'll make a note of it as something to have though
yeah and thanks
Sorry about the delay in getting new features to the bot 😅 still working on getting up to parity with the open source version
no problem
You can achieve this as well using precondition decorators right or am I mistaken?
You can yes but that's essentially the same as extracting the code to a function.