Conditional cooldown for debugging commands

Md Shahriyar Alam

4 days 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

pyif 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.

pyif 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. 🚀

Need help?

If you still need any kind of help, have a suggestion for us or having a question in mind? Feel free to reach us out.

Join support server
logoCustom Commands

#1 Custom commands discord bot available on the internet

We Accept

stripe

Contact

20-22 Wenlock RoadEnglandN1 7GU

© WEiRDSOFT LTD. All rights reserved.