Add cooldown on custom commands

Md Shahriyar Alam

4 months ago

If you want to control how often commands can be executed in Custom Commands bot. You need to use cooldowns. To add cooldown to a command you need to cooldowns in it. To add cooldowns to slash command you need to use the cooldown programmed variabe

Code

Use these codes in Hooks (pre)

pycooldown("1 minutes", user.id)

Essentially what this code will do is, make the command cooldown for 1 minutes after last execution, so the user can't use it for next 1 minutes.

in place of user.id if you put server.id it will put this cooldown globally. Which means the cooldown is now global. And if anyone of the server use it. It will be unavailable for other users too for next 1 minute.

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.

DiscordJoin support server
logoCustom Commands

#1 Custom commands discord bot available on the internet

stripe

Contact

2 Frederick StreetLondonWC1X 0ND

© WEiRDSOFT LTD. All rights reserved.