Bot scoring
You have spam scoring, I would like bot scoring too. I have implemetned myself, but you could probably do better: const botScore = calculateBotScore(user.emailStats); if(botScore>= 65) { return new Response(Bot score too high ${botScore}, { status: 403 }); } else if(now - previousInboundTime 0) responseTimes.push(responseTime); } if (responseTimes.length > 1) { const mean = responseTimes.reduce((a, b) => a + b) / responseTimes.length; const variance = responseTimes.reduce((acc, rt) => acc + Math.pow(rt - mean, 2), 0) / responseTimes.length; const coefficientOfVariation = Math.sqrt(variance) / mean; // Low variation = more bot-like const consistencyBonus = coefficientOfVariation < 0.3 ? 15 : 0; return Math.min(100, Math.round(avgSuspicion + consistencyBonus)); } return Math.min(100, Math.round(avgSuspicion)); }
