feat: Add Live Emote Updates for BTTV (#4147)

This feature is enabled by default and can be disabled in settings with the "Enable BTTV live emotes updates" setting.

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2023-01-21 15:06:55 +01:00
committed by GitHub
parent 56f7c91a64
commit 904749cf62
22 changed files with 856 additions and 33 deletions
+26 -6
View File
@@ -593,17 +593,37 @@ MessageBuilder::MessageBuilder(LiveUpdatesUpdateEmoteMessageTag /*unused*/,
const QString &oldEmoteName)
: MessageBuilder()
{
auto text = QString("renamed %1 emote %2 to %3.")
.arg(platform, oldEmoteName, emoteName);
QString text;
if (actor.isEmpty())
{
text = "Renamed";
}
else
{
text = "renamed";
}
text +=
QString(" %1 emote %2 to %3.").arg(platform, oldEmoteName, emoteName);
this->emplace<TimestampElement>();
this->emplace<TextElement>(actor, MessageElementFlag::Username,
MessageColor::System)
->setLink({Link::UserInfo, actor});
if (!actor.isEmpty())
{
this->emplace<TextElement>(actor, MessageElementFlag::Username,
MessageColor::System)
->setLink({Link::UserInfo, actor});
}
this->emplace<TextElement>(text, MessageElementFlag::Text,
MessageColor::System);
auto finalText = QString("%1 %2").arg(actor, text);
QString finalText;
if (actor.isEmpty())
{
finalText = text;
}
else
{
finalText = QString("%1 %2").arg(actor, text);
}
this->message().loginName = actor;
this->message().messageText = finalText;