Cooldown filter precondition
I wish to create a cooldown for a command but instead of filtering by user (
cooldownFilteredUsers
), I want to filter it with a precondition (ie user has a certain role in the guild). What is the best way to do this?
(I don't want to deny the command usage, just apply a cooldown for users who do not meet the precondition.)Solution:Jump to solution
Yeah i realised afterwards that it didn't work as intended. and the precondition didn't run 😦
I wanted to extend the cooldown precondition method because I'm not sure how to code the cooldown myself. So i thought to just add to the super method...
5 Replies
Extend the class and override the methods
Would it be something like this?
That restricts outright rather than being a cooldown but other than that, yes
If you're going that route I would recommend just extending
Precondition
instead of SubcommandPreconditions.PluginSubcommandCooldown
Solution
Yeah i realised afterwards that it didn't work as intended. and the precondition didn't run 😦
I wanted to extend the cooldown precondition method because I'm not sure how to code the cooldown myself. So i thought to just add to the super method
The code is open source on github 🙂 you can just copy pasta code