Skip to content

Commit e13c239

Browse files
Convert Cyrillic lookalikes to Latin in everyone/here check
1 parent 1568aec commit e13c239

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Checks/ListChecks.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class ListChecks
66
{
77
// Map of Cyrillic to Latin characters, to catch attempted bypasses using Cyrillic lookalikes
88
// <string, string> is <Cyrillic, Latin>
9-
static Dictionary<string, string> alphabetMap = new()
9+
public static Dictionary<string, string> alphabetMap = new()
1010
{
1111
{ "А", "A" },
1212
{ "В", "B" },

Events/MessageEvent.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,10 @@ public static async Task MessageHandlerAsync(DiscordClient client, MockDiscordMe
640640
}
641641

642642
// attempted to ping @everyone/@here
643-
if (Program.cfgjson.EveryoneFilter && !member.Roles.Any(role => Program.cfgjson.EveryoneExcludedRoles.Contains(role.Id)) && !Program.cfgjson.EveryoneExcludedChannels.Contains(channel.Id) && (message.Content.Contains("@everyone") || message.Content.Contains("@here")))
643+
var msgContent = message.Content;
644+
foreach (var letter in Checks.ListChecks.alphabetMap)
645+
msgContent = msgContent.Replace(letter.Key, letter.Value);
646+
if (Program.cfgjson.EveryoneFilter && !member.Roles.Any(role => Program.cfgjson.EveryoneExcludedRoles.Contains(role.Id)) && !Program.cfgjson.EveryoneExcludedChannels.Contains(channel.Id) && (msgContent.Contains("@everyone") || msgContent.Contains("@here")))
644647
{
645648
if (wasAutoModBlock)
646649
{

0 commit comments

Comments
 (0)