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:
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
Jump to solution
9 Replies
Solution
Favna
Favna2y ago
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
Sawako
Sawako2y ago
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...
Favna
Favna2y ago
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.
Rhys
Rhys2y ago
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
Favna
Favna2y ago
yeah and thanks
Rhys
Rhys2y ago
Sorry about the delay in getting new features to the bot 😅 still working on getting up to parity with the open source version
Favna
Favna2y ago
no problem
Dolliwyx
Dolliwyx2y ago
You can achieve this as well using precondition decorators right or am I mistaken?
Favna
Favna2y ago
You can yes but that's essentially the same as extracting the code to a function.
Want results from more Discord servers?
Add your server