Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More prevention and less fake trigger #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions BLART/Modules/SpamPrevention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,39 @@ public class SpamPrevention
{
private static Dictionary<SocketUser, (DateTime, int)> SpamTracker { get; } = new();
private static readonly Regex Regex = new(@"^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

private static readonly List<string> BlacklistWebSite = new()
{
"xnxx.com",
"pornhub.com",
"xvideos.com",
"fuq.com",
"xhamster.com",
"tukif.com",
"youporn.com",
"mvideoporno.com",
"qorno.com",
"porn300.com",
"ixxx.com",
"youporngay.com",
"fapvid.com",
"pornoplus.com",
"vidmo.com",
"absoluporn.com",
"its.porn",
"bestgore.com",
"hentaihaven.com"
"bit.ly"
};
private static readonly List<string> WhitelistedDiscord = new()
{
"scpsl", // scpsl official
"PyUkWTg", // Exiled official
"dtPGCsm", // DiscoHook official
"csharp", // Csharp official
"p69SGfwxxm", // CedMod by ced777ric
"3j54zBnbbD", // Scripted-Event by Thunder's
"JwAfeSd79u", // MER (MapEditorReborn) by Michal
};
public static Task OnMessageReceived(SocketMessage arg) => OnMessageReceived(arg, false);

public static async Task OnMessageReceived(SocketMessage message, bool skipSpam)
Expand Down Expand Up @@ -105,12 +137,11 @@ private static bool IsBlockedContent(string url)
{
url = url.ToLowerInvariant();

if (url.Contains("pornhub.com") || url.Contains("xvideos.com") || url.Contains("hentaihaven.com") ||
url.Contains("redtube.com") || url.Contains("bestgore.com"))
if (BlacklistWebSite.Any(x => BlacklistWebSite.Contains(x)))
return true;

if (url.Contains("discord.gg"))
if (!url.Contains("scpsl") && !url.Contains("PyUkWTg"))
if (!WhitelistedDiscord.Any(x => url.EndsWith(x)))
return true;

return false;
Expand Down Expand Up @@ -170,4 +201,4 @@ await Logging.SendLogMessage($"User auto-{(RaidProtection.Check(message.User) ?
}
}
}
}
}