Conditional cooldown for debugging custom commands
Want to have different cooldown for different user groups?
Md Shahriyar Alam
2 years ago
By utilizing the new has_permission or has_any_permission we can have conditional cooldowns in a command.
Lets say we want a 10 seconds cooldown for administrators and 1 minute cooldown for other users. We can use the has_permission function.
Code
if has_permission(user, "administrator"):
cooldown("10 seconds", user.id)
else:
cooldown("1 minutes", user.id)Using this code in pre-hook will allow admins to use the command every 10 seconds, but other users will have a 1 minute cooldown.
If you want no cooldown for admins you can also do that easily by using the code below.
if not has_permission(user, "administrator"):
cooldown("1 minutes", user.id)This code will check if the user dont have the administrator permission, he will have 1 minute cooldown, Otherwise no cooldown.
Possibilities are endless. You just have to think. 🚀
Loading comments…
Need help?
Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.