WOKCommands
  • WOKCommands Documentation
  • Useful Links
    • Setup & Options object
    • 🧠 Build a website dashboard, monetize your bot, and get more users
    • 💰 $100 in FREE Hosting Credits
    • 🙋‍♂️ Support Server
    • 📺 YouTube Channel
  • Commands
    • Ping pong command example
    • Command properties
    • Correct argument usage
    • Command initialization method
    • Bot owner only commands
    • Test servers
    • Cooldowns
    • Required permissions
    • Slash commands
    • Inferred slash command arguments
    • Custom slash command arguments
    • Autocomplete
  • Command Validations
    • Validation setup
    • Runtime validations
    • Syntax validations
  • Event Handler
    • Event Handling
    • Dynamic Validations
  • Features
    • Features
  • Built-in commands and features
    • Enabling and disabling commands
    • Configurable required roles
    • Configurable required permissions
    • Per-guild prefixes
    • Customizable channel specific commands
    • Custom commands
Powered by GitBook
On this page

Was this helpful?

  1. Commands

Cooldowns

PreviousTest serversNextRequired permissions

Last updated 1 year ago

Was this helpful?

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:

Cooldown Type
Description

perUser

Applies to a specific user across all guilds and DMs

perUserPerGuild

Applies to a specific user in a specific guild

perGuild

Applies to all users in a specific guild

global

Applies to all users in all guilds

Example of per-user cooldowns:

daily.js
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!",
    };
  },
};
daily.ts
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;