Show picked outcome in prediction badges. (#3357)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL 2021-11-20 11:52:27 +00:00 committed by GitHub
parent f58f35292a
commit 56f2207d22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -32,6 +32,7 @@
- Minor: IRC now parses/displays links like Twitch chat. (#3334) - Minor: IRC now parses/displays links like Twitch chat. (#3334)
- Minor: Added button & label for copying login name of user instead of display name in the user info popout. (#3335) - Minor: Added button & label for copying login name of user instead of display name in the user info popout. (#3335)
- Minor: Make `/delete` errors a bit more verbose (#3350) - Minor: Make `/delete` errors a bit more verbose (#3350)
- Minor: Show picked outcome in prediction badges. (#3357)
- Minor: Add support for Emoji in IRC (#3354) - Minor: Add support for Emoji in IRC (#3354)
- Bugfix: Fixed colored usernames sometimes not working. (#3170) - Bugfix: Fixed colored usernames sometimes not working. (#3170)
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166) - Bugfix: Restored ability to send duplicate `/me` messages. (#3166)

View file

@ -1101,6 +1101,22 @@ void TwitchMessageBuilder::appendTwitchBadges()
.arg(subMonths); .arg(subMonths);
} }
} }
else if (badge.flag_ == MessageElementFlag::BadgePredictions)
{
auto badgeInfoIt = badgeInfos.find(badge.key_);
if (badgeInfoIt != badgeInfos.end())
{
auto predictionText =
badgeInfoIt->second
.replace("\\s", " ") // standard IRC escapes
.replace("\\:", ";")
.replace("\\\\", "\\")
.replace("", ","); // twitch's comma escape
// Careful, the first character is RIGHT LOW PARAPHRASE BRACKET or U+2E1D, which just looks like a comma
tooltip = QString("Predicted %1").arg(predictionText);
}
}
this->emplace<BadgeElement>(badgeEmote.get(), badge.flag_) this->emplace<BadgeElement>(badgeEmote.get(), badge.flag_)
->setTooltip(tooltip); ->setTooltip(tooltip);