Skip to content

🚀 This new wiki is in beta! Please double-check for any issue and report them on the GitHub

Slash Command Cooldowns

Cooldowns prevent users from spamming the same slash command repeatedly. When a cooldown is active, Discord shows an error message telling the user they’re on cooldown.

When a user tries to execute a slash command while on cooldown:

  1. Discord triggers the on slash cooldown event instead of the normal command event
  2. Your bot can respond with a custom message
  3. Or you can cancel the cooldown to allow execution anyway

Cooldowns are defined directly on the slash command:

on ready:
set {_cmd} to new slash command named "vote" with description "Vote for something"
# Set a 1-hour cooldown (applies per user)
set cooldown of {_cmd} to 1 hour
update {_cmd} globally in event-bot

Use the on slash cooldown event to handle users on cooldown:

on slash cooldown:
# Get how long until the cooldown expires
set {_remaining} to remaining time of cooldown
# Reply with a friendly message
reply with hidden "You're on cooldown! Try again in %{_remaining}%"
  • event-string — Command name
  • event-user — User on cooldown
  • event-guild — Guild where command is used
  • remaining time of cooldown — Time until cooldown expires

You can allow users to bypass cooldowns by cancelling the event:

on slash cooldown:
# Allow admins to bypass cooldown
if event-user has permission "ADMINISTRATOR":
cancel event
stop
# Reject others
reply with hidden "You're on cooldown!"

Default behavior — each user has their own cooldown:

set cooldown of {_cmd} to 30 seconds

Prevent any user from using the command for a period:

set global cooldown of {_cmd} to 5 minutes

Different cooldowns for different user types:

on slash cooldown:
if event-user has permission "ADMINISTRATOR":
cancel event
else if event-user has role "Premium":
# Premium users get shorter cooldown
reply with hidden "Premium cooldown: %remaining time of cooldown%"
else:
reply with hidden "Regular cooldown: %remaining time of cooldown%"
  1. Use reasonable cooldowns — 5-60 seconds is typical, avoid excessive spam prevention
  2. Provide feedback — Always tell users when they’re on cooldown and when it expires
  3. Consider permissions — Admins or moderators might bypass cooldowns
  4. Test thoroughly — Ensure cooldown timing matches your needs
on ready:
set {_vote} to new slash command named "vote" with description "Vote for the server"
set cooldown of {_vote} to 1 hour
update {_vote} globally in event-bot
on slash command:
if event-string is "vote":
# User voted, increment counter
add 1 to {votes}
reply with "✅ Thanks for voting! Total votes: %{votes}%"
on slash cooldown:
if event-string is "vote":
set {_time} to remaining time of cooldown
reply with hidden "You already voted! Come back in %{_time}%"
  • Verify cooldown is set on the command
  • Check that Discord received the command update (can take up to 1 hour for global commands)
  • Use guild commands for instant testing
  • Ensure you have an on slash cooldown handler
  • Verify the command name matches exactly