UNPKG

@shadow-dev/core

Version:

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

15 lines (13 loc) 438 B
const cooldowns = new Map<string, number>(); export function checkCooldown(userId: string, command: string, cooldownTime: number): boolean { 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; }