From 48bb46bdfa17c2b8f3779c25ca0be16d3a011e14 Mon Sep 17 00:00:00 2001 From: spiral Date: Tue, 20 Sep 2022 16:24:51 +0000 Subject: [PATCH] fix(proxy): correctly apply Discord webhook name restrictions (part 2) --- PluralKit.Bot/Services/WebhookExecutorService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Services/WebhookExecutorService.cs b/PluralKit.Bot/Services/WebhookExecutorService.cs index 7f58456b..3ea0fb6f 100644 --- a/PluralKit.Bot/Services/WebhookExecutorService.cs +++ b/PluralKit.Bot/Services/WebhookExecutorService.cs @@ -251,6 +251,7 @@ public static class ProxyNameExt .FixClyde() .FixHere() .FixEveryone() + .FixDiscord() .FixBackticks() .FixSingleCharacterName() .ThrowOnInvalidCharacters(); @@ -271,7 +272,10 @@ public static class ProxyNameExt => Regex.Replace(name, "(e)(veryone)", Replacement, RegexOptions.IgnoreCase); static string FixBackticks(this string name) - => Regex.Replace(name, "(e)(veryone)", Replacement, RegexOptions.IgnoreCase); + => Regex.Replace(name, "(`)(``)", Replacement, RegexOptions.IgnoreCase); + + static string FixDiscord(this string name) + => Regex.Replace(name, "(d)(iscord)", Replacement, RegexOptions.IgnoreCase); // Adds a Unicode hair space (\u200A) between the "c" and the "lyde" to avoid Discord matching it // since Discord blocks webhooks containing the word "Clyde"... for some reason. /shrug