Как сделать так, что если нашло мат из списка то ретурна не будет!
строка foreach (string bannedword in WordFilter_Phrases)
Отвечает за мат
return filtered где filtered это var filtered = original;
private string FilterText(IPlayer player, string original)
{
var filtered = original;
int count = 0;
Regex r = new Regex(regextouse, RegexOptions.IgnoreCase);
foreach (var word in original.Split(' '))
if (UseRegex)
{
Match m = r.Match(word);
if (m.Success)
{
Puts($"REGEX MATCH : {player.Name} said: \"{original}\" which contained a bad word: \"{word}\"");
filtered = filtered.Replace(word, Replace(word));
count++;
}
}
foreach (string bannedword in WordFilter_Phrases)
{
if (TranslateLeet(word).ToLower().Contains(bannedword.ToLower()))
{
Puts($"BANNED WORDS MATCH : {player.Name} said: \"{original}\" which contained a bad word: \"{word}\"");
filtered = filtered.Replace(word, Replace(word));
count++;
}
}
}
if (count > 0)
{
Offsense(player);
}
{
return filtered;
}
}
строка foreach (string bannedword in WordFilter_Phrases)
Отвечает за мат
return filtered где filtered это var filtered = original;
private string FilterText(IPlayer player, string original)
{
var filtered = original;
int count = 0;
Regex r = new Regex(regextouse, RegexOptions.IgnoreCase);
foreach (var word in original.Split(' '))
if (UseRegex)
{
Match m = r.Match(word);
if (m.Success)
{
Puts($"REGEX MATCH : {player.Name} said: \"{original}\" which contained a bad word: \"{word}\"");
filtered = filtered.Replace(word, Replace(word));
count++;
}
}
foreach (string bannedword in WordFilter_Phrases)
{
if (TranslateLeet(word).ToLower().Contains(bannedword.ToLower()))
{
Puts($"BANNED WORDS MATCH : {player.Name} said: \"{original}\" which contained a bad word: \"{word}\"");
filtered = filtered.Replace(word, Replace(word));
count++;
}
}
}
if (count > 0)
{
Offsense(player);
}
{
return filtered;
}
}