Change botspam to ignore symbols

This commit is contained in:
ArcticZeroo 2018-01-09 19:43:37 -05:00 committed by Alexander Meech
parent 2b00363bfc
commit d8f7a998ef

View File

@ -24,7 +24,7 @@ public class SpamText
public boolean isSpam(String message)
{
//System.out.println(message.toLowerCase() + " vs " + _text.toLowerCase() + " == " + message.toLowerCase().contains(_text.toLowerCase()));
return message.toLowerCase().contains(_text.toLowerCase());
return clean(message).contains(clean(_text));
}
public int getId()
@ -76,4 +76,10 @@ public class SpamText
{
_disabledBy = disabledBy;
}
private static String clean(String text)
{
// Replace all non alphanumeric/whitespace characters
return text.toLowerCase().replaceAll("[^\\w\\d\\s]", "");
}
}