logoCustom Commands
    BlogPrivacyPremiumSupport
Back to blog
// blog

Add cooldown on custom commands

Add cooldown on slash commands

Md Shahriyar Alam

2 years ago

·1 min read

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)

py
cooldown("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.

Loading comments…

{}

Need help?

Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.

DiscordJoin support server
logoCustom Commands

The #1 custom commands Discord bot — build commands, events and databases with zero boilerplate.

stripe

Links

HomeBlogPrivacySupport

Contact

[email protected]

2 Frederick StreetLondon, WC1X 0ND

{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.