Skip to content

Commit ddebeed

Browse files
committed
Cooldown category update
1 parent 31ffe57 commit ddebeed

5 files changed

Lines changed: 183 additions & 179 deletions

File tree

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,61 @@
11
# $channelCooldown
22

3-
Sets a cooldown for a command, *per channel*! This means the command can only be used again in the specific channel after the specified cooldown has expired.
3+
Sets a cooldown for a command in channel.
44

5-
#### Usage:
5+
## Usage
66

7-
`$channelCooldown[time (default is 5s);Error message]`
7+
```bash
8+
$channelCooldown[time;error message]
9+
```
10+
1. **time** - (Optional) default value: `5s`. The cooldown duration. Example times: `10s`, `1m`, `2h`, `1d`
11+
2. **error message** - (Optional) default value: (none). The message to send if a cooldown is still in progress.
812

9-
* **time:** The cooldown duration. Defaults to 5 seconds if not provided. Examples: `10s`, `1m`, `2h`, `1d`.
10-
* **Error message:** The message to send when a user tries to use the command before the cooldown expires.
13+
## Example
1114

12-
### Example:
15+
#### Using $channelCooldown
16+
17+
As you can see, first time it will set the cooldown and execute code below, second time, it won't allow execution
1318

1419
<discord-messages>
15-
<discord-message :bot="false" role-color="#ffcc9a" author="Member">
16-
!!exec $channelCooldown[2h;You can get points again after %time%]<br>
17-
$sendMessage[You received 100x points.]
18-
</discord-message>
19-
<discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp">
20-
You can get points again after 1 hour 54 minutes and 56 seconds
21-
</discord-message>
20+
<discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png">
21+
!!exec $channelCooldown[5m;You're on cooldown!]<br>
22+
You're not on cooldown!
23+
</discord-message>
24+
<discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png">
25+
You're not on cooldown!
26+
</discord-message>
27+
<discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png">
28+
!!exec $channelCooldown[5m;You're on cooldown! Still %mins%m remaining!]<br>
29+
You're not on cooldown!
30+
</discord-message>
31+
<discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png">
32+
You're on cooldown! Still 4m remaining!
33+
</discord-message>
2234
</discord-messages>
2335

24-
In this example, the command will give the user 100 points. If they try to use the command again within 2 hours in the same channel, they will receive the error message: "You can get points again after [remaining time]".
25-
26-
## Usable Macros in Error Message:
36+
## Placeholders
2737

28-
These macros can be used in your error message to provide dynamic information about the cooldown.
38+
Available placeholders you can use in error message
2939

30-
| Macro | Description | Output Example |
31-
| ------------ | ------------------------------------------------- | ---------------------------------------- |
32-
| `%time%` | Replaced with the remaining time in a readable format. | `5 days 1 hour 54 minutes and 56 seconds` |
33-
| `%days%` | The number of days remaining. | `5` |
34-
| `%hrs%` | The number of hours remaining. | `1` |
35-
| `%mins%` | The number of minutes remaining. | `54` |
36-
| `%secs%` | The number of seconds remaining. | `56` |
37-
| `%timestamp%` | Unix timestamp (seconds) for when the cooldown expires. | `1680711176` |
38-
| `%relative%` | Displays the remaining time using Discord's relative timestamp feature (updates automatically). | ![](https://i.imgur.com/F2bAFnk.png) |
40+
| Placeholder | Description | Output Example |
41+
| ------------- | --------------------------------------------------------- | ----------------------------------------- |
42+
| `%time%` | The full time remaining | `1 day 2 hours 3 minutes and 4 seconds` |
43+
| `%days%` | The number of days remaining | `1` |
44+
| `%hrs%` | The number of hours remaining | `2` |
45+
| `%mins%` | The number of minutes remaining | `3` |
46+
| `%secs%` | The number of seconds remaining | `4` |
47+
| `%timestamp%` | Timestamp of cooldown expiration in seconds | `1735689600` |
48+
| `%relative%` | Shows Discord relative timestamp (Automatically Updates) | `<t:1735689600:R>` - Displays: `in 1 day` |
3949

40-
::: tip Note
41-
You can send styled messages or embeds by using the [Message Curl Format](../CodeReferences/ref.message_curl_format.md) in the error message.
50+
::: warning Warning
51+
Place this function above the code you want to use cooldown for. All code before this function will be executed.
4252
:::
43-
44-
::: tip Related Functions
45-
* [$cooldown](../Cooldown/cooldown.md): Sets a cooldown for a command, *per user*.
46-
* [$serverCooldown](../Cooldown/serverCooldown.md): Sets a cooldown for a command, *per server*.
53+
::: tip Suggestion
54+
You can send embeds, select menus and buttons by using the [message curl format](../CodeReferences/ref.message_curl_format.md).
4755
:::
4856

49-
::: danger Important
50-
Place the `$channelCooldown` function on the **FIRST line** of your command's code. If it's not the first line, the code before it will execute regardless of the cooldown, and the cooldown won't apply correctly.
51-
:::
5257

53-
##### Function Difficulty: <Badge type="tip" text="Easy" vertical="middle" />
58+
##### Related functions: [$cooldown](../Cooldown/cooldown.md) [$serverCooldown](../Cooldown/serverCooldown.md)
5459

55-
###### Tags: <Badge type="tip" text="Cooldown" vertical="middle" /> <Badge type="tip" text="Channel Cooldown" vertical="middle" /> <Badge type="tip" text="Raid Limit" vertical="middle" /> <Badge type="tip" text="Raid Limited" vertical="middle" />
60+
##### Function Difficulty: <Badge type="tip" text="Easy" vertical="middle" />
61+
###### Tags: <Badge type="tip" text="Cooldown" vertical="middle" /> <Badge type="tip" text="Channel Cooldown" vertical="middle" /> <Badge type="tip" text="Limit" vertical="middle" />

guide/Cooldown/clearCoolDown_ai.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
# $clearCooldown
22

3-
Clears a cooldown set by the `$cooldown` function. This allows you to bypass or reset cooldowns for specific users, channels, or servers.
3+
Clears a cooldown set by cooldown function.
44

55
**Type:** Clears or resets a pre-existing cooldown.
66

77
## Usage
88

99
```bash
10-
$clearCooldown[type (optional, default: user); id (optional, default: "$authorID")]
10+
$clearCooldown[type;id]
1111
```
12-
13-
**Parameters:**
14-
15-
* **`type` (Optional):** Specifies the scope of the cooldown to clear. Can be one of the following:
16-
* `user`: Clears the cooldown for a specific user. (Default)
17-
* `channel`: Clears the cooldown for the current channel.
18-
* `server`: Clears the cooldown for the current server.
19-
* **`id` (Optional):** Specifies the ID of the user, channel, or server to clear the cooldown for. Defaults to `$authorID` (the user who triggered the command) if no ID is provided.
20-
21-
## Example: Cooldown Exception for a Specific User
22-
23-
This example demonstrates how to set a cooldown for everyone *except* a specific user. The user "Mido" will be exempt from the cooldown.
24-
25-
```bash
26-
$cooldown[1m;You are in cooldown because you are not Mido]
27-
$if[$username==Mido]
28-
$clearCooldown[user;$authorID]
29-
$endIf
30-
```
31-
32-
**Explanation:**
33-
34-
1. **`$cooldown[1m;You are in cooldown because you are not Mido]`**: This line sets a 1-minute cooldown for all users executing the command. The message "You are in cooldown because you are not Mido" will be displayed if a user tries to use the command within the cooldown period.
35-
2. **`$if[$username==Mido]`**: This checks if the username of the user executing the command is "Mido".
36-
3. **`$clearCooldown[user;$authorID]`**: If the username is "Mido", this line clears the cooldown specifically for that user (`$authorID`). This means Mido can bypass the 1-minute cooldown.
37-
4. **`$endIf`**: Closes the `$if` statement.
38-
39-
In summary, this example sets a general cooldown but then removes it for the user "Mido", allowing them to use the command without waiting.
12+
1. **type** - (Optional) default value: `user`. Can be `user`, `channel` or `server`. The type of cooldown to clear.
13+
2. **id** - (Optional) default value: `$authorID` if type is user. The ID of a user or channel to clear cooldown from.
14+
15+
## Example
16+
17+
#### Remove cooldown from a user
18+
19+
How to remove cooldown from a user
20+
21+
<discord-messages>
22+
<discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png">
23+
!!exec $cooldown[5m]<br>
24+
$clearCooldown<br>
25+
No cooldown
26+
</discord-message>
27+
<discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png">
28+
No cooldown
29+
</discord-message>
30+
<discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png">
31+
!!exec $cooldown[5m]<br>
32+
$clearCooldown<br>
33+
No cooldown 2nd try
34+
</discord-message>
35+
<discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png">
36+
No cooldown 2nd try
37+
</discord-message>
38+
</discord-messages>
39+
40+
##### Related functions: [$getCooldownTime](../Cooldown/getCooldownTime.md)
41+
42+
##### Function difficulty: <Badge type="tip" text="Easy" vertical="middle"/>
43+
###### Tags: <Badge type="tip" text="Cooldown" vertical="middle"/> <Badge type="tip" text="Clear Cooldown" vertical="middle"/>

guide/Cooldown/cooldown_ai.md

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,62 @@
11
# $cooldown
22

3-
Sets a per-user cooldown for a command. This prevents users from spamming a command within a specified timeframe.
3+
Sets a cooldown in a command for user.
44

5-
#### Usage:
5+
## Usage
66

7-
`$cooldown[time (default 5s);Error message;user id (optional)]`
7+
```bash
8+
$cooldown[time;error message;userID]
9+
```
10+
1. **time** - (Optional) default value: `5s`. The cooldown duration. Example times: `10s`, `1m`, `2h`, `1d`
11+
2. **error message** - (Optional) default value: (none). The message to send if a cooldown is still in progress.
12+
3. **userID** - (Optional) default value: `$authorID`. The ID of a user you want to set a cooldown to.
813

9-
* **time:** The duration of the cooldown. Defaults to 5 seconds if not provided. Examples: `10s`, `1m`, `2h`, `1d`.
10-
* **Error message:** The message displayed to the user if they try to use the command before the cooldown expires. You can use macros in this message (see below).
11-
* **user id (optional):** Apply the cooldown to a specific user ID instead of the user executing the command. Useful for moderator commands.
14+
## Example
1215

13-
### Example:
16+
#### Using $cooldown
1417

15-
This example sets a 2-hour cooldown on a command that gives the user points. If the user tries to use the command before the cooldown expires, they will receive a message indicating how much time is left.
18+
As you can see, first time it will set the cooldown and execute code below, second time, it won't allow execution
1619

1720
<discord-messages>
18-
<discord-message :bot="false" role-color="#ffcc9a" author="Member">
19-
!!exec $cooldown[2h;You can get points again after %time%]<br>
20-
$sendMessage[You received 100x points.]<br>
21-
</discord-message>
22-
<discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp">
23-
You can get points again after 1 hour 54 minutes and 56 seconds<br><br>
24-
</discord-message>
21+
<discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png">
22+
!!exec $cooldown[5m;You're on cooldown!]<br>
23+
You're not on cooldown!
24+
</discord-message>
25+
<discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png">
26+
You're not on cooldown!
27+
</discord-message>
28+
<discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png">
29+
!!exec $cooldown[5m;You're on cooldown! Still %mins%m remaining!]<br>
30+
You're not on cooldown!
31+
</discord-message>
32+
<discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png">
33+
You're on cooldown! Still 4m remaining!
34+
</discord-message>
2535
</discord-messages>
2636

27-
## Usable Macros In Message:
37+
## Placeholders
2838

29-
These macros can be used in the `Error message` to provide dynamic information about the remaining cooldown time.
39+
Available placeholders you can use in error message
3040

31-
| Macro | Description | Output Example |
32-
| -------------- | -------------------------------------------- | ------------------------------------- |
33-
| `%time%` | Human-readable time remaining. | 5 days 1 hour 54 minutes and 56 seconds |
34-
| `%days%` | Days remaining. | 5 |
35-
| `%hrs%` | Hours remaining. | 1 |
36-
| `%mins%` | Minutes remaining. | 54 |
37-
| `%secs%` | Seconds remaining. | 56 |
38-
| `%timestamp%` | UNIX timestamp (in seconds) of cooldown expiration. | 1680711176 |
39-
| `%relative%` | Discord's relative timestamp (auto-updates). | ![](https://i.imgur.com/F2bAFnk.png) |
41+
| Placeholder | Description | Output Example |
42+
| ------------- | --------------------------------------------------------- | ----------------------------------------- |
43+
| `%time%` | The full time remaining | `1 day 2 hours 3 minutes and 4 seconds` |
44+
| `%days%` | The number of days remaining | `1` |
45+
| `%hrs%` | The number of hours remaining | `2` |
46+
| `%mins%` | The number of minutes remaining | `3` |
47+
| `%secs%` | The number of seconds remaining | `4` |
48+
| `%timestamp%` | Timestamp of cooldown expiration in seconds | `1735689600` |
49+
| `%relative%` | Shows Discord relative timestamp (Automatically Updates) | `<t:1735689600:R>` - Displays: `in 1 day` |
4050

41-
::: tip Note
42-
You can send an embed as the error message using [Message Curl Format](../CodeReferences/ref.message_curl_format.md).
51+
::: warning Warning
52+
Place this function above the code you want to use cooldown for. All code before this function will be executed.
4353
:::
44-
45-
::: tip Related Functions
46-
47-
* [$channelCooldown](../Cooldown/channelCooldown.md): For a channel-based cooldown.
48-
* [$serverCooldown](../Cooldown/serverCooldown.md): For a server-based cooldown.
49-
54+
::: tip Suggestion
55+
You can send embeds, select menus and buttons by using the [message curl format](../CodeReferences/ref.message_curl_format.md).
5056
:::
5157

52-
::: danger Important
5358

54-
Place this code on the **FIRST** line of your command's code. If it's not the first line, the code *before* `$cooldown` will execute regardless of the cooldown.
55-
56-
:::
59+
##### Related functions: [$channelCooldown](../Cooldown/channelCooldown.md) [$serverCooldown](../Cooldown/serverCooldown.md)
5760

58-
##### Function difficulty <Badge type="tip" text="Easy" vertical="middle" />
59-
###### Tags: <Badge type="tip" text="Cooldown" vertical="middle" /> <Badge type="tip" text="Wait" vertical="middle" /> <Badge type="tip" text="Raid Limit" vertical="middle" /> <Badge type="tip" text="Raid Limited" vertical="middle" />
61+
##### Function Difficulty: <Badge type="tip" text="Easy" vertical="middle" />
62+
###### Tags: <Badge type="tip" text="Cooldown" vertical="middle" /> <Badge type="tip" text="Limit" vertical="middle" />

0 commit comments

Comments
 (0)