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

Function isRiskyCommand

src/utils/abuseProtection.js:130–147  ·  view source on GitHub ↗
(command, commandName)

Source from the content-addressed store, hash-verified

128}
129
130export function isRiskyCommand(command, commandName) {
131 const protectionEnabled = command?.abuseProtection?.enabled;
132 if (protectionEnabled === false) {
133 return false;
134 }
135
136 if (protectionEnabled === true) {
137 return true;
138 }
139
140 const normalizedName = normalizeCommandName(commandName);
141 if (RISKY_COMMAND_NAMES.has(normalizedName)) {
142 return true;
143 }
144
145 const normalizedCategory = normalizeCommandCategory(command);
146 return RISKY_COMMAND_CATEGORIES.has(normalizedCategory);
147}
148
149export async function enforceAbuseProtection(interaction, command, commandName) {
150 if (!isRiskyCommand(command, commandName)) {

Callers 2

enforceAbuseProtectionFunction · 0.85

Calls 2

normalizeCommandNameFunction · 0.85
normalizeCommandCategoryFunction · 0.85

Tested by

no test coverage detected