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

Function trackVerificationAttempt

src/services/verificationService.js:537–562  ·  view source on GitHub ↗
(
    userId,
    guildId,
    maxAttempts = defaultMaxAttempts,
    windowMs = defaultAttemptWindowMs
)

Source from the content-addressed store, hash-verified

535}
536
537export async function trackVerificationAttempt(
538 userId,
539 guildId,
540 maxAttempts = defaultMaxAttempts,
541 windowMs = defaultAttemptWindowMs
542) {
543 pruneVerificationTrackers();
544
545 const key = `${guildId}:${userId}`;
546 const attempts = attemptTracker.get(key) || [];
547 const now = Date.now();
548
549 const recentAttempts = attempts.filter(timestamp => now - timestamp < windowMs);
550
551 if (recentAttempts.length >= maxAttempts) {
552 throw createError(
553 "Too many verification attempts",
554 ErrorTypes.RATE_LIMIT,
555 "You've attempted too many times. Please wait a moment.",
556 { attempts: recentAttempts.length, maxAttempts }
557 );
558 }
559
560 recentAttempts.push(now);
561 attemptTracker.set(key, recentAttempts);
562}
563
564async function sendAutoVerifyNotification(member, role, guild) {
565 try {

Callers 1

verifyUserFunction · 0.85

Calls 4

createErrorFunction · 0.90
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected