(command, commandName)
| 128 | } |
| 129 | |
| 130 | export 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 | |
| 149 | export async function enforceAbuseProtection(interaction, command, commandName) { |
| 150 | if (!isRiskyCommand(command, commandName)) { |
no test coverage detected