mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Show exact months subscribed in Subscriber and Founder badge tooltip (#1424)
This commit is contained in:
parent
d99102cd23
commit
c00f97ac53
1 changed files with 49 additions and 4 deletions
|
@ -1251,14 +1251,59 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (badge.startsWith("founder/"))
|
||||||
|
{
|
||||||
|
if (auto badgeEmote =
|
||||||
|
this->twitchChannel->globalTwitchBadges().badge("founder",
|
||||||
|
"0"))
|
||||||
|
{
|
||||||
|
auto badgeInfo = this->tags.find("badge-info");
|
||||||
|
if (badgeInfo != this->tags.end() &&
|
||||||
|
badgeInfo.value().toString().split(',')[0].startsWith(
|
||||||
|
"founder/"))
|
||||||
|
{
|
||||||
|
auto subMonths =
|
||||||
|
badgeInfo.value().toString().split(',')[0].mid(8);
|
||||||
|
this->emplace<BadgeElement>(
|
||||||
|
badgeEmote.get(),
|
||||||
|
MessageElementFlag::BadgeSubscription)
|
||||||
|
->setTooltip(QString((*badgeEmote)->tooltip.string) +
|
||||||
|
" (" + subMonths + " months)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->emplace<BadgeElement>(
|
||||||
|
badgeEmote.get(),
|
||||||
|
MessageElementFlag::BadgeSubscription)
|
||||||
|
->setTooltip((*badgeEmote)->tooltip.string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (badge.startsWith("subscriber/"))
|
else if (badge.startsWith("subscriber/"))
|
||||||
{
|
{
|
||||||
if (auto badgeEmote = this->twitchChannel->twitchBadge(
|
if (auto badgeEmote = this->twitchChannel->twitchBadge(
|
||||||
"subscriber", badge.mid(11)))
|
"subscriber", badge.mid(11)))
|
||||||
{
|
{
|
||||||
this->emplace<BadgeElement>(
|
auto badgeInfo = this->tags.find("badge-info");
|
||||||
badgeEmote.get(), MessageElementFlag::BadgeSubscription)
|
if (badgeInfo != this->tags.end() &&
|
||||||
->setTooltip((*badgeEmote)->tooltip.string);
|
badgeInfo.value().toString().split(',')[0].startsWith(
|
||||||
|
"subscriber/"))
|
||||||
|
{
|
||||||
|
auto subMonths =
|
||||||
|
badgeInfo.value().toString().split(',')[0].mid(11);
|
||||||
|
this->emplace<BadgeElement>(
|
||||||
|
badgeEmote.get(),
|
||||||
|
MessageElementFlag::BadgeSubscription)
|
||||||
|
->setTooltip(QString((*badgeEmote)->tooltip.string) +
|
||||||
|
" (" + subMonths + " months)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->emplace<BadgeElement>(
|
||||||
|
badgeEmote.get(),
|
||||||
|
MessageElementFlag::BadgeSubscription)
|
||||||
|
->setTooltip((*badgeEmote)->tooltip.string);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1292,7 +1337,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace chatterino
|
||||||
|
|
||||||
void TwitchMessageBuilder::appendChatterinoBadges()
|
void TwitchMessageBuilder::appendChatterinoBadges()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue