BUG: Ensure that voice-triggered auto-punishments more thoroughly check for OOC blocks

This commit is contained in:
bananarama92 2024-11-15 23:12:06 +01:00
parent 318326c9c7
commit fe350e50df
No known key found for this signature in database
GPG key ID: ECBC951D6255A50F

View file

@ -268,10 +268,11 @@ const PropertyAutoPunishKeywords = [
* @returns {boolean} Whether the passed message should trigger automatic speech-based punishment
*/
function PropertyAutoPunishParseMessage(Sensitivity, msg) {
// Conditions which are never punishable
if (msg.startsWith("(")) {
return false;
}
// Remove the OOC component(s) from the message, as those are never punishable
const oocRanges = SpeechGetOOCRanges(msg).reverse();
const arrayMsg = Array.from(msg);
oocRanges.forEach(({ start, length }) => arrayMsg.splice(start, length));
msg = arrayMsg.join("");
// Conditions that are always punishable
const PunishableSpeech = (