Recipes
Cooldown
Although you can implement your own cooldown logic, you might wanna try @slipher/cooldown first.
First you need to add cooldown property to client as shown below
And then we can use @Cooldown() decorator in our commands, it takes 3 arguments:
| Property | Type | Description |
|---|---|---|
| type | CooldownType | target type, can be user, guild or channel |
| interval | number | time to refresh uses |
| uses | number | how many uses user can use this command in the given interval |
And then we need to create a middleware for handle when the user is in cooldown: