Skip to content

Commit

Permalink
Enforce SFW FA Links
Browse files Browse the repository at this point in the history
  • Loading branch information
ishauny authored and ishauny committed Dec 18, 2023
1 parent 4350c1c commit a20a3eb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Floofbot/Services/RaidProtectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ private bool CheckInviteLinks(SocketMessage msg, ulong guildId)
}
return false;
}
private bool CheckFALinks(SocketMessage msg, ulong guildId) // filter out if not sfw domain but no muting
{
var regex = "(?<!sfw\\.)(furaffinity.net)";
if (Regex.IsMatch(msg.Content, regex))
{
msg.Channel.SendMessageAsync(msg.Author.Mention + " please use the sfw furaffinity domain (sfw.furaffinity.net) for all FA URLs!");
return true;
}
return false;
}
private bool CheckEmojiSpam(SocketMessage msg, ulong guildId)
{
// check for repeated custom and normal emojis.
Expand Down Expand Up @@ -422,9 +432,13 @@ public async Task<bool> CheckMessage(FloofDataContext _floofDb, SocketMessage ms
bool userSpammedInviteLink = CheckInviteLinks(userMsg, guild.Id);
// check for spammed emojis
bool userSpammedEmojis = CheckEmojiSpam(userMsg, guild.Id);
// check for FA links without sfw domain
bool userWrongFALink = CheckFALinks(userMsg, guild.Id);

if (spammedMentions)
return false; // user already banned
if (userWrongFALink)
return true; // user already informed to use sfw domain so finished
if (filteredWord || userSpammedMessages || userSpammedLetters || userSpammedInviteLink || userSpammedEmojis)
{
if (userPunishmentCount[guild.Id].ContainsKey(userMsg.Author.Id))
Expand Down

0 comments on commit a20a3eb

Please sign in to comment.