Skip to content

Commit 17a785a

Browse files
Don't skip GuildMemberAdded tasks if member is in 'unbanned' db hash
1 parent 8e86957 commit 17a785a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Events/MemberEvents.cs

+20-20
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,36 @@ public static async Task GuildMemberAdded(DiscordClient client, GuildMemberAdded
6565
await e.Member.TimeoutAsync(null, "Removing timeout since member was presumably unmuted while left");
6666
}
6767

68-
if (db.HashExists("unbanned", e.Member.Id))
69-
return;
70-
71-
if (avatars.Contains(e.Member.AvatarHash))
68+
if (!db.HashExists("unbanned", e.Member.Id))
7269
{
73-
var _ = BanHelpers.BanSilently(e.Guild, e.Member.Id, "Secret sauce");
74-
await LogChannelHelper.LogMessageAsync("investigations", $"{cfgjson.Emoji.Banned} Raid-banned {e.Member.Mention} for matching avatar: {e.Member.AvatarUrl.Replace("1024", "128")}");
75-
}
70+
if (avatars.Contains(e.Member.AvatarHash))
71+
{
72+
var _ = BanHelpers.BanSilently(e.Guild, e.Member.Id, "Secret sauce");
73+
await LogChannelHelper.LogMessageAsync("investigations", $"{cfgjson.Emoji.Banned} Raid-banned {e.Member.Mention} for matching avatar: {e.Member.AvatarUrl.Replace("1024", "128")}");
74+
}
7675

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

81-
foreach (var IdAutoBanSet in cfgjson.AutoBanIds)
82-
{
83-
if (db.HashExists(IdAutoBanSet.Name, e.Member.Id))
80+
foreach (var IdAutoBanSet in cfgjson.AutoBanIds)
8481
{
85-
continue;
86-
}
82+
if (db.HashExists(IdAutoBanSet.Name, e.Member.Id))
83+
{
84+
continue;
85+
}
8786

88-
if (e.Member.Id > IdAutoBanSet.LowerBound && e.Member.Id < IdAutoBanSet.UpperBound)
89-
{
90-
await e.Member.SendMessageAsync(banDM);
87+
if (e.Member.Id > IdAutoBanSet.LowerBound && e.Member.Id < IdAutoBanSet.UpperBound)
88+
{
89+
await e.Member.SendMessageAsync(banDM);
9190

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

94-
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.");
95-
}
93+
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.");
94+
}
9695

97-
db.HashSet(IdAutoBanSet.Name, e.Member.Id, true);
96+
db.HashSet(IdAutoBanSet.Name, e.Member.Id, true);
97+
}
9898
}
9999

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

0 commit comments

Comments
 (0)