From b66c2478a03c571fbb5c4d0ecf2a079712ba34e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82?= <44851575+zneix@users.noreply.github.com> Date: Sun, 5 Jul 2020 14:08:28 +0200 Subject: [PATCH] Added higher tier information to sub badge tooltip (#1759) --- src/providers/twitch/TwitchMessageBuilder.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index ed587f78d..10979d972 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -995,8 +995,17 @@ void TwitchMessageBuilder::appendTwitchBadges() auto badgeInfoIt = badgeInfos.find(badge.key_); if (badgeInfoIt != badgeInfos.end()) { + // badge.value_ is 4 chars long if user is subbed on higher tier + // (tier + amount of months with leading zero if less than 100) + // e.g. 3054 - tier 3 4,5-year sub. 2108 - tier 2 9-year sub + const auto &subTier = + badge.value_.length() > 3 ? badge.value_.front() : '1'; const auto &subMonths = badgeInfoIt->second; - tooltip += QString(" (%0 months)").arg(subMonths); + tooltip += + QString(" (%1%2 months)") + .arg(subTier != '1' ? QString("Tier %1, ").arg(subTier) + : "") + .arg(subMonths); } }