mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
feat: pass off raid message to raid-specific message builder
This commit is contained in:
parent
2cc492a26f
commit
8bfcd99be9
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue