UNPKG

@shadow-dev/core

Version:

A modular core framework for Discord bot development, providing commands, buttons, menus, middleware, and more.

17 lines (16 loc) 483 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkCooldown = checkCooldown; const cooldowns = new Map(); function checkCooldown(userId, command, cooldownTime) { const key = `${userId}-${command}`; const now = Date.now(); if (cooldowns.has(key)) { const expiration = cooldowns.get(key); if (now < expiration) { return false; } } cooldowns.set(key, now + cooldownTime); return true; }