This commit is contained in:
Daniella / Tove 2024-05-29 14:49:43 +02:00
parent 02f5016243
commit a6709ce84e

View file

@ -41,6 +41,9 @@ public class ChatFilter extends Feature {
@Config("Filter possibly ableist") @Config("Filter possibly ableist")
public boolean lesserAbleist = false; public boolean lesserAbleist = false;
@Config("Filter -oid")
public boolean oid = false;
@Override @Override
public String toString() { public String toString() {
return "ChatFilter"; return "ChatFilter";
@ -55,7 +58,7 @@ public class ChatFilter extends Feature {
if(ethnic) { if(ethnic) {
for (String slur : ETHNIC_SLURS) { for (String slur : ETHNIC_SLURS) {
if(containsWord(message, slur)) { if(containsWord(message, slur)) {
message = filter(message, slur, "ethnic"); message = filter(message, slur, "ethnic slur");
changed = true; changed = true;
} }
} }
@ -63,7 +66,7 @@ public class ChatFilter extends Feature {
if(queerphobic) { if(queerphobic) {
for (String slur : QUEERPHOBIC_SLURS) { for (String slur : QUEERPHOBIC_SLURS) {
if(containsWord(message, slur)) { if(containsWord(message, slur)) {
message = filter(message, slur, "qphob"); message = filter(message, slur, "qphob slur");
changed = true; changed = true;
} }
} }
@ -71,7 +74,7 @@ public class ChatFilter extends Feature {
if(lesserQueerphobic) { if(lesserQueerphobic) {
for (String slur : LESSER_QUEERPHOBIC_SLURS) { for (String slur : LESSER_QUEERPHOBIC_SLURS) {
if(containsWord(message, slur)) { if(containsWord(message, slur)) {
message = filter(message, slur, "Pqphob"); message = filter(message, slur, "Pqphob slur");
changed = true; changed = true;
} }
} }
@ -79,7 +82,7 @@ public class ChatFilter extends Feature {
if(ableist) { if(ableist) {
for (String slur : ABLEIST_SLURS) { for (String slur : ABLEIST_SLURS) {
if(containsWord(message, slur)) { if(containsWord(message, slur)) {
message = filter(message, slur, "ableist"); message = filter(message, slur, "ableist slur");
changed = true; changed = true;
} }
} }
@ -87,7 +90,15 @@ public class ChatFilter extends Feature {
if(lesserAbleist) { if(lesserAbleist) {
for (String slur : LESSER_ABLEIST_SLURS) { for (String slur : LESSER_ABLEIST_SLURS) {
if(containsWord(message, slur)) { if(containsWord(message, slur)) {
message = filter(message, slur, "Pableist"); message = filter(message, slur, "Pableist slur");
changed = true;
}
}
}
if(oid) {
for (String oid : OID) {
if(containsWord(message, oid)) {
message = filter(message, oid, "oid");
changed = true; changed = true;
} }
} }
@ -128,7 +139,7 @@ public class ChatFilter extends Feature {
result.append(matcher.group().replaceFirst("[aeiou]", "*")); result.append(matcher.group().replaceFirst("[aeiou]", "*"));
break; break;
case Replace: case Replace:
result.append("[").append(type).append(" slur removed]"); result.append("[").append(type).append(" removed]");
break; break;
} }
last = matcher.end(); last = matcher.end();
@ -144,6 +155,7 @@ public class ChatFilter extends Feature {
public static final String[] ETHNIC_SLURS = new String[] { public static final String[] ETHNIC_SLURS = new String[] {
"nig+a?e?h?r*", "nig+a?e?h?r*",
"negr+o(id)?",
}; };
public static final String[] QUEERPHOBIC_SLURS = new String[] { public static final String[] QUEERPHOBIC_SLURS = new String[] {
@ -172,5 +184,9 @@ public class ChatFilter extends Feature {
"delusional", "delusional",
}; };
public static final String[] OID = new String[] {
"\\w*oid",
};
// THE HORROR END // THE HORROR END
} }