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

Function getAnomalyPolicy

src/utils/abuseProtection.js:62–72  ·  view source on GitHub ↗
(command)

Source from the content-addressed store, hash-verified

60}
61
62function getAnomalyPolicy(command) {
63 const anomaly = command?.abuseProtection?.anomaly || {};
64 const threshold = Number.isInteger(anomaly.threshold) && anomaly.threshold > 0
65 ? anomaly.threshold
66 : DEFAULT_ANOMALY_POLICY.threshold;
67 const windowMs = Number.isInteger(anomaly.windowMs) && anomaly.windowMs > 0
68 ? anomaly.windowMs
69 : DEFAULT_ANOMALY_POLICY.windowMs;
70
71 return { threshold, windowMs };
72}
73
74function getProtectionKey(interaction, commandName) {
75 const guildScope = interaction.guildId || 'dm';

Callers 1

recordBlockedAttemptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected