From 26418871addb60d31b58031d43272ab8d84fc919 Mon Sep 17 00:00:00 2001 From: kittens Date: Wed, 12 Aug 2020 10:51:59 -0400 Subject: [PATCH 1/2] Fix doubleBacktick replacing --- PluralKit.Bot/Utils/DiscordUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PluralKit.Bot/Utils/DiscordUtils.cs b/PluralKit.Bot/Utils/DiscordUtils.cs index cfc911ca..c6d10b75 100644 --- a/PluralKit.Bot/Utils/DiscordUtils.cs +++ b/PluralKit.Bot/Utils/DiscordUtils.cs @@ -212,7 +212,7 @@ namespace PluralKit.Bot public static string EscapeBacktickPair(this string input){ Regex doubleBacktick = new Regex(@"``", RegexOptions.Multiline); //Run twice to catch any pairs that are created from the first pass, pairs shouldn't be created in the second as they are created from odd numbers of backticks, even numbers are all caught on the first pass - if(input != null) return doubleBacktick.Replace(doubleBacktick.Replace(input, @"`‌ `"),@"`‌`"); + if(input != null) return doubleBacktick.Replace(doubleBacktick.Replace(input, @"`‌`"),@"`‌`"); else return input; } @@ -326,4 +326,4 @@ namespace PluralKit.Bot return $"<{match.Value}>"; }); } -} \ No newline at end of file +} From 2d9111727d186f48ac2052624892bd5e062535c4 Mon Sep 17 00:00:00 2001 From: kittens Date: Wed, 12 Aug 2020 11:05:11 -0400 Subject: [PATCH 2/2] Use unicode escape sequence for less confusion --- PluralKit.Bot/Utils/DiscordUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluralKit.Bot/Utils/DiscordUtils.cs b/PluralKit.Bot/Utils/DiscordUtils.cs index c6d10b75..4203518b 100644 --- a/PluralKit.Bot/Utils/DiscordUtils.cs +++ b/PluralKit.Bot/Utils/DiscordUtils.cs @@ -212,7 +212,7 @@ namespace PluralKit.Bot public static string EscapeBacktickPair(this string input){ Regex doubleBacktick = new Regex(@"``", RegexOptions.Multiline); //Run twice to catch any pairs that are created from the first pass, pairs shouldn't be created in the second as they are created from odd numbers of backticks, even numbers are all caught on the first pass - if(input != null) return doubleBacktick.Replace(doubleBacktick.Replace(input, @"`‌`"),@"`‌`"); + if(input != null) return doubleBacktick.Replace(doubleBacktick.Replace(input, "`‌\ufeff`"),"`‌\ufeff`"); else return input; }