fix: extended fix for emotes being cut off in replies to all mentions

This commit is contained in:
Zoe Martin 2021-06-25 12:54:49 +02:00
parent b156f6a9cb
commit 2aac97d2a0
No known key found for this signature in database
GPG Key ID: 65238C3E138FFBE9

View File

@ -177,13 +177,12 @@ namespace PluralKit.Bot
if (msg.Length > 100)
{
msg = repliedTo.Content.Substring(0, 100);
var openedEmotesInTruncatedString = Regex.Matches(msg, @"<a?:").Count;
var fullEmotesInTruncatedString = Regex.Matches(msg, @"<a?:\w+:\d+>").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, @"<a?:\w+:\d+$"))
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;