mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 22:37:54 +00:00
fix: emotes being cut off in replies
This commit is contained in:
parent
0dfea56d83
commit
b156f6a9cb
1 changed files with 9 additions and 0 deletions
|
|
@ -177,6 +177,15 @@ 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 emoteTail = repliedTo.Content.Substring(100).Split(">")[0];
|
||||
if (Regex.IsMatch(msg + emoteTail, @"<a?:\w+:\d+$"))
|
||||
msg += emoteTail + ">";
|
||||
}
|
||||
|
||||
var spoilersInOriginalString = Regex.Matches(repliedTo.Content, @"\|\|").Count;
|
||||
var spoilersInTruncatedString = Regex.Matches(msg, @"\|\|").Count;
|
||||
if (spoilersInTruncatedString % 2 == 1 && spoilersInOriginalString % 2 == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue