MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / checkVerificationCooldown

Function checkVerificationCooldown

src/services/verificationService.js:518–535  ·  view source on GitHub ↗
(userId, guildId, cooldownMs = defaultCooldownMs)

Source from the content-addressed store, hash-verified

516}
517
518export async function checkVerificationCooldown(userId, guildId, cooldownMs = defaultCooldownMs) {
519 pruneVerificationTrackers();
520
521 const key = `${guildId}:${userId}`;
522 const lastVerified = verificationCooldowns.get(key);
523
524 if (lastVerified && Date.now() - lastVerified < cooldownMs) {
525 const remaining = cooldownMs - (Date.now() - lastVerified);
526 throw createError(
527 "User on verification cooldown",
528 ErrorTypes.RATE_LIMIT,
529 `Please wait ${Math.ceil(remaining / 1000)} seconds before verifying again.`,
530 { userId, guildId, cooldownRemaining: remaining }
531 );
532 }
533
534 verificationCooldowns.set(key, Date.now());
535}
536
537export async function trackVerificationAttempt(
538 userId,

Callers 1

verifyUserFunction · 0.85

Calls 4

createErrorFunction · 0.90
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected