From b156f6a9cb36538949d7c6b69123a1b0ab8ca65e Mon Sep 17 00:00:00 2001 From: Zoe Martin Date: Fri, 25 Jun 2021 12:34:44 +0200 Subject: [PATCH] fix: emotes being cut off in replies --- PluralKit.Bot/Proxy/ProxyService.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PluralKit.Bot/Proxy/ProxyService.cs b/PluralKit.Bot/Proxy/ProxyService.cs index e2ef6dd8..31d86b70 100644 --- a/PluralKit.Bot/Proxy/ProxyService.cs +++ b/PluralKit.Bot/Proxy/ProxyService.cs @@ -177,6 +177,15 @@ namespace PluralKit.Bot if (msg.Length > 100) { msg = repliedTo.Content.Substring(0, 100); + var openedEmotesInTruncatedString = Regex.Matches(msg, @"").Count; + if (openedEmotesInTruncatedString != fullEmotesInTruncatedString) + { + var emoteTail = repliedTo.Content.Substring(100).Split(">")[0]; + if (Regex.IsMatch(msg + emoteTail, @""; + } + var spoilersInOriginalString = Regex.Matches(repliedTo.Content, @"\|\|").Count; var spoilersInTruncatedString = Regex.Matches(msg, @"\|\|").Count; if (spoilersInTruncatedString % 2 == 1 && spoilersInOriginalString % 2 == 0)