feat: pass off raid message to raid-specific message builder

This commit is contained in:
James Upjohn 2024-10-16 13:23:57 +13:00
parent 2cc492a26f
commit 8bfcd99be9
No known key found for this signature in database
GPG key ID: C2A35391BA777173

View file

@ -531,6 +531,40 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
{
messageText = "Announcement";
}
else if (msgType == "raid")
{
auto loginTag = tags.find("login");
auto displayNameTag = tags.find("msg-param-displayName");
if (loginTag != tags.end() && displayNameTag != tags.end())
{
auto login = loginTag.value().toString();
MessageColor color = MessageColor::System;
if (auto *tc = dynamic_cast<TwitchChannel *>(channel))
{
if (auto userColor = tc->getUserColor(login);
userColor.isValid())
{
color = MessageColor(userColor);
}
}
auto displayName = displayNameTag.value().toString();
auto b = MessageBuilder(raidEntryMessage,
parseTagString(messageText),
login, displayName, color,
calculateMessageTime(message).time());
b->flags.set(MessageFlag::Subscription);
if (mirrored)
{
b->flags.set(MessageFlag::SharedMessage);
}
auto newMessage = b.release();
builtMessages.emplace_back(newMessage);
return builtMessages;
}
}
else if (msgType == "subgift")
{
if (auto monthsIt = tags.find("msg-param-gift-months");