Skip to content

Commit

Permalink
Don't skip GuildMemberAdded tasks if member is in 'unbanned' db hash
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Aug 1, 2024
1 parent 8e86957 commit 17a785a
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions Events/MemberEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,36 +65,36 @@ public static async Task GuildMemberAdded(DiscordClient client, GuildMemberAdded
await e.Member.TimeoutAsync(null, "Removing timeout since member was presumably unmuted while left");
}

if (db.HashExists("unbanned", e.Member.Id))
return;

if (avatars.Contains(e.Member.AvatarHash))
if (!db.HashExists("unbanned", e.Member.Id))
{
var _ = BanHelpers.BanSilently(e.Guild, e.Member.Id, "Secret sauce");
await LogChannelHelper.LogMessageAsync("investigations", $"{cfgjson.Emoji.Banned} Raid-banned {e.Member.Mention} for matching avatar: {e.Member.AvatarUrl.Replace("1024", "128")}");
}
if (avatars.Contains(e.Member.AvatarHash))
{
var _ = BanHelpers.BanSilently(e.Guild, e.Member.Id, "Secret sauce");
await LogChannelHelper.LogMessageAsync("investigations", $"{cfgjson.Emoji.Banned} Raid-banned {e.Member.Mention} for matching avatar: {e.Member.AvatarUrl.Replace("1024", "128")}");
}

string banDM = $"You have been automatically banned from **{e.Guild.Name}** for matching patterns of known raiders.\n" +
string banDM = $"You have been automatically banned from **{e.Guild.Name}** for matching patterns of known raiders.\n" +
$"Please send an appeal and you will be unbanned as soon as possible: {cfgjson.AppealLink}\n" +
$"The requirements for appeal can be ignored in this case. Sorry for any inconvenience caused.";

foreach (var IdAutoBanSet in cfgjson.AutoBanIds)
{
if (db.HashExists(IdAutoBanSet.Name, e.Member.Id))
foreach (var IdAutoBanSet in cfgjson.AutoBanIds)
{
continue;
}
if (db.HashExists(IdAutoBanSet.Name, e.Member.Id))
{
continue;
}

if (e.Member.Id > IdAutoBanSet.LowerBound && e.Member.Id < IdAutoBanSet.UpperBound)
{
await e.Member.SendMessageAsync(banDM);
if (e.Member.Id > IdAutoBanSet.LowerBound && e.Member.Id < IdAutoBanSet.UpperBound)
{
await e.Member.SendMessageAsync(banDM);

await e.Member.BanAsync(TimeSpan.FromDays(7), "Matching patterns of known raiders, please unban if appealed.");
await e.Member.BanAsync(TimeSpan.FromDays(7), "Matching patterns of known raiders, please unban if appealed.");

await LogChannelHelper.LogMessageAsync("investigations", $"{cfgjson.Emoji.Banned} Automatically appeal-banned {e.Member.Mention} for matching the creation date of the {IdAutoBanSet.Name} DM scam raiders.");
}
await LogChannelHelper.LogMessageAsync("investigations", $"{cfgjson.Emoji.Banned} Automatically appeal-banned {e.Member.Mention} for matching the creation date of the {IdAutoBanSet.Name} DM scam raiders.");
}

db.HashSet(IdAutoBanSet.Name, e.Member.Id, true);
db.HashSet(IdAutoBanSet.Name, e.Member.Id, true);
}
}

// Restore user overrides stored in db (if there are any)
Expand Down

0 comments on commit 17a785a

Please sign in to comment.