$cooldown
Sets a cooldown in a command for user.
Usage
$cooldown[time;error message;userID]
- time - (Optional) default value:
5s. The cooldown duration. Example times:10s,1m,2h,1d - error message - (Optional) default value: (none). The message to send if a cooldown is still in progress.
- userID - (Optional) default value:
$authorID. The ID of a user you want to set a cooldown to.
Example
Using $cooldown
As you can see, first time it will set the cooldown and execute code below, second time, it won't allow execution
Placeholders
Available placeholders you can use in error message
| Placeholder | Description | Output Example |
|---|---|---|
%time% | The full time remaining | 1 day 2 hours 3 minutes and 4 seconds |
%days% | The number of days remaining | 1 |
%hrs% | The number of hours remaining | 2 |
%mins% | The number of minutes remaining | 3 |
%secs% | The number of seconds remaining | 4 |
%timestamp% | Timestamp of cooldown expiration in seconds | 1735689600 |
%relative% | Shows Discord relative timestamp (Automatically Updates) | <t:1735689600:R> - Displays: in 1 day |
Warning
Place this function above the code you want to use cooldown for. All code before this function will be executed.
Suggestion
You can send embeds, select menus and buttons by using the message curl format.
