From 2aac97d2a06c4d0dce9b5c16e1328fb00bd7afb9 Mon Sep 17 00:00:00 2001 From: Zoe Martin Date: Fri, 25 Jun 2021 12:54:49 +0200 Subject: [PATCH] fix: extended fix for emotes being cut off in replies to all mentions --- PluralKit.Bot/Proxy/ProxyService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/PluralKit.Bot/Proxy/ProxyService.cs b/PluralKit.Bot/Proxy/ProxyService.cs index 31d86b70..90cf0e7e 100644 --- a/PluralKit.Bot/Proxy/ProxyService.cs +++ b/PluralKit.Bot/Proxy/ProxyService.cs @@ -177,13 +177,12 @@ namespace PluralKit.Bot if (msg.Length > 100) { msg = repliedTo.Content.Substring(0, 100); - var openedEmotesInTruncatedString = Regex.Matches(msg, @"").Count; - if (openedEmotesInTruncatedString != fullEmotesInTruncatedString) + var endsWithOpenMention = Regex.IsMatch(msg, @"<[at]?[@#:][!&]?(\w+:)?(\d+)?(:[tTdDfFR])?$"); + if (endsWithOpenMention) { - var emoteTail = repliedTo.Content.Substring(100).Split(">")[0]; - if (Regex.IsMatch(msg + emoteTail, @""; + var mentionTail = repliedTo.Content.Substring(100).Split(">")[0]; + if (Regex.IsMatch(msg + mentionTail, @"<[at]?[@#:][!&]?(\w+:)?\d+(:[tTdDfFR])?$")) + msg += mentionTail + ">"; } var spoilersInOriginalString = Regex.Matches(repliedTo.Content, @"\|\|").Count;