$cooldown

Sets a cooldown. The user can not run the command again, until the ‘duration’ is up.

Syntax

$cooldown[Duration;Error message]

Parameters

  • Duration (Type: Duration || Flag: Required): The duration of this cooldown.
  • Error message (Type: String || Flag: Emptiable): The message that is returned when the cooldown duration is still ongoing. %time% and other related functions can be used here.
TimeIn UsageLimit
Yeary191568
Weekw9988936
Dayd69922554
Hourh1678141301
Minutem100688478068
Seconds6041308684139

%time% returns how much time is left on the cooldown.

Example

$nomention
$cooldown[30s;Please wait %time%, then use that command again!]
Hi!
!example Hi !example Please wait 27 Seconds, then use that command again!

If you are using BDScript 2, then all functions above $cooldown[] will always work.

❌ Not correct:

$nomention
$setUserVar[Money;$sum[$getUserVar[Money];5]]
$sendMessage[You worked successfully and earned 5 🪙]
$cooldown[30s;Please wait %time%, then use !work command again!]

Your bot will always add 5🪙 to “Money” variable.

✅ Correct:

$nomention
$cooldown[30s;Please wait %time%, then use !work command again!]
$setUserVar[Money;$sum[$getUserVar[Money];5]]
$sendMessage[You worked successfully and earned 5 🪙]

How $setUserVar[] and $sendMessage[] works?

Recommendation

You can also use these functions: