> For the complete documentation index, see [llms.txt](https://docs.wornoffkeys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wornoffkeys.com/commands/command-cooldowns.md).

# Cooldowns

{% embed url="<https://youtu.be/_67r4wq23BA?t=329>" %}

You can use command cooldowns to ensure your commands are only ran every so often. Each cooldown type requires a string for it's duration and duration type (seconds, minutes, etc)

| Character | Duration | Example |
| --------- | -------- | ------- |
| s         | Seconds  | 30 s    |
| m         | Minutes  | 10 m    |
| h         | Hours    | 5 h     |
| d         | Days     | 3 d     |

There are 4 types of cooldowns:

<table><thead><tr><th width="191">Cooldown Type</th><th>Description</th></tr></thead><tbody><tr><td>perUser</td><td>Applies to a specific user across all guilds and DMs</td></tr><tr><td>perUserPerGuild</td><td>Applies to a specific user in a specific guild</td></tr><tr><td>perGuild</td><td>Applies to all users in a specific guild</td></tr><tr><td>global</td><td>Applies to all users in all guilds</td></tr></tbody></table>

Example of per-user cooldowns:

{% tabs %}
{% tab title="JavaScript" %}
{% code title="daily.js" %}

```javascript
const { CommandType, CooldownTypes } = require("wokcommands");

module.exports = {
  description: "Ping pong command",

  type: CommandType.BOTH,

  cooldowns: {
    type: CooldownTypes.perUser,
    duration: "1 d",
  },

  callback: () => {
    return {
      content: "Pong!",
    };
  },
};
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="daily.ts" %}

```typescript
import { CommandObject, CommandType, CooldownTypes } from "wokcommands";

export default {
  description: "Ping pong command",

  type: CommandType.BOTH,

  cooldowns: {
    type: CooldownTypes.perUser,
    duration: "1 d",
  },

  callback: () => {
    return {
      content: "Pong!",
    };
  },
} as CommandObject;
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wornoffkeys.com/commands/command-cooldowns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
