Fix announcement rendering (#3639)

* Fix announcement rendering

* Changelog

* Add test message to Window.cpp
This commit is contained in:
Mm2PL 2022-04-01 00:24:19 +02:00 committed by GitHub
parent e41a2e8408
commit 832e34186b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -2,6 +2,8 @@
## Unversioned ## Unversioned
- Bugfix: Fixed rendering of moderator announcements. (#3639)
## 2.3.5 ## 2.3.5
- Major: Added highlights for first messages (#3267) - Major: Added highlights for first messages (#3267)

View file

@ -31,6 +31,7 @@ static const QSet<QString> specialMessageTypes{
"resub", // resub messages "resub", // resub messages
"bitsbadgetier", // bits badge upgrade "bitsbadgetier", // bits badge upgrade
"ritual", // new viewer ritual "ritual", // new viewer ritual
"announcement", // new mod announcement thing
}; };
MessagePtr generateBannedMessage(bool confirmedBan) MessagePtr generateBannedMessage(bool confirmedBan)
@ -649,6 +650,10 @@ std::vector<MessagePtr> IrcMessageHandler::parseUserNoticeMessage(
kFormatNumbers( kFormatNumbers(
tags.value("msg-param-threshold").toInt())); tags.value("msg-param-threshold").toInt()));
} }
else if (msgType == "announcement")
{
messageText = "Announcement";
}
auto b = MessageBuilder(systemMessage, parseTagString(messageText), auto b = MessageBuilder(systemMessage, parseTagString(messageText),
calculateMessageTimestamp(message)); calculateMessageTimestamp(message));
@ -699,6 +704,10 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
kFormatNumbers( kFormatNumbers(
tags.value("msg-param-threshold").toInt())); tags.value("msg-param-threshold").toInt()));
} }
else if (msgType == "announcement")
{
messageText = "Announcement";
}
auto b = MessageBuilder(systemMessage, parseTagString(messageText), auto b = MessageBuilder(systemMessage, parseTagString(messageText),
calculateMessageTimestamp(message)); calculateMessageTimestamp(message));

View file

@ -229,6 +229,9 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
// Message with founder badge // Message with founder badge
miscMessages.emplace_back(R"(@badge-info=founder/72;badges=founder/0,bits/5000;color=#FF0000;display-name=TranRed;emotes=;first-msg=0;flags=;id=7482163f-493d-41d9-b36f-fba50e0701b7;mod=0;room-id=11148817;subscriber=0;tmi-sent-ts=1641123773885;turbo=0;user-id=57019243;user-type= :tranred!tranred@tranred.tmi.twitch.tv PRIVMSG #pajlada :GFMP pajaE)"); miscMessages.emplace_back(R"(@badge-info=founder/72;badges=founder/0,bits/5000;color=#FF0000;display-name=TranRed;emotes=;first-msg=0;flags=;id=7482163f-493d-41d9-b36f-fba50e0701b7;mod=0;room-id=11148817;subscriber=0;tmi-sent-ts=1641123773885;turbo=0;user-id=57019243;user-type= :tranred!tranred@tranred.tmi.twitch.tv PRIVMSG #pajlada :GFMP pajaE)");
// mod announcement
miscMessages.emplace_back(R"(@badge-info=subscriber/47;badges=broadcaster/1,subscriber/3012,twitchconAmsterdam2020/1;color=#FF0000;display-name=Supinic;emotes=;flags=;id=8c26e1ab-b50c-4d9d-bc11-3fd57a941d90;login=supinic;mod=0;msg-id=announcement;msg-param-color=PRIMARY;room-id=31400525;subscriber=1;system-msg=;tmi-sent-ts=1648762219962;user-id=31400525;user-type= :tmi.twitch.tv USERNOTICE #supinic :mm test lol)");
// various link tests // various link tests
linkMessages.emplace_back(R"(@badge-info=subscriber/48;badges=broadcaster/1,subscriber/36,partner/1;color=#CC44FF;display-name=pajlada;emotes=;flags=;id=3c23cf3c-0864-4699-a76b-089350141147;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1577628844607;turbo=0;user-id=11148817;user-type= :pajlada!pajlada@pajlada.tmi.twitch.tv PRIVMSG #pajlada : Links that should pass: )" + getValidLinks().join(' ')); linkMessages.emplace_back(R"(@badge-info=subscriber/48;badges=broadcaster/1,subscriber/36,partner/1;color=#CC44FF;display-name=pajlada;emotes=;flags=;id=3c23cf3c-0864-4699-a76b-089350141147;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1577628844607;turbo=0;user-id=11148817;user-type= :pajlada!pajlada@pajlada.tmi.twitch.tv PRIVMSG #pajlada : Links that should pass: )" + getValidLinks().join(' '));
linkMessages.emplace_back(R"(@badge-info=subscriber/48;badges=broadcaster/1,subscriber/36,partner/1;color=#CC44FF;display-name=pajlada;emotes=;flags=;id=3c23cf3c-0864-4699-a76b-089350141147;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1577628844607;turbo=0;user-id=11148817;user-type= :pajlada!pajlada@pajlada.tmi.twitch.tv PRIVMSG #pajlada : Links that should NOT pass: )" + getInvalidLinks().join(' ')); linkMessages.emplace_back(R"(@badge-info=subscriber/48;badges=broadcaster/1,subscriber/36,partner/1;color=#CC44FF;display-name=pajlada;emotes=;flags=;id=3c23cf3c-0864-4699-a76b-089350141147;mod=0;room-id=11148817;subscriber=1;tmi-sent-ts=1577628844607;turbo=0;user-id=11148817;user-type= :pajlada!pajlada@pajlada.tmi.twitch.tv PRIVMSG #pajlada : Links that should NOT pass: )" + getInvalidLinks().join(' '));