Added custom FrankerFaceZ VIP badges (#2628)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -269,6 +269,12 @@ void TwitchChannel::refreshFFZChannelEmotes(bool manualRefresh)
|
||||
this->ffzCustomModBadge_.set(std::move(modBadge));
|
||||
}
|
||||
},
|
||||
[this, weak = weakOf<Channel>(this)](auto &&vipBadge) {
|
||||
if (auto shared = weak.lock())
|
||||
{
|
||||
this->ffzCustomVipBadge_.set(std::move(vipBadge));
|
||||
}
|
||||
},
|
||||
manualRefresh);
|
||||
}
|
||||
|
||||
@@ -1067,6 +1073,11 @@ boost::optional<EmotePtr> TwitchChannel::ffzCustomModBadge() const
|
||||
return this->ffzCustomModBadge_.get();
|
||||
}
|
||||
|
||||
boost::optional<EmotePtr> TwitchChannel::ffzCustomVipBadge() const
|
||||
{
|
||||
return this->ffzCustomVipBadge_.get();
|
||||
}
|
||||
|
||||
boost::optional<CheerEmote> TwitchChannel::cheerEmote(const QString &string)
|
||||
{
|
||||
auto sets = this->cheerEmoteSets_.access();
|
||||
|
||||
@@ -100,6 +100,7 @@ public:
|
||||
|
||||
// Badges
|
||||
boost::optional<EmotePtr> ffzCustomModBadge() const;
|
||||
boost::optional<EmotePtr> ffzCustomVipBadge() const;
|
||||
boost::optional<EmotePtr> twitchBadge(const QString &set,
|
||||
const QString &version) const;
|
||||
|
||||
@@ -171,6 +172,7 @@ protected:
|
||||
Atomic<std::shared_ptr<const EmoteMap>> bttvEmotes_;
|
||||
Atomic<std::shared_ptr<const EmoteMap>> ffzEmotes_;
|
||||
Atomic<boost::optional<EmotePtr>> ffzCustomModBadge_;
|
||||
Atomic<boost::optional<EmotePtr>> ffzCustomVipBadge_;
|
||||
|
||||
private:
|
||||
// Badges
|
||||
|
||||
@@ -1128,6 +1128,18 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (badge.key_ == "vip")
|
||||
{
|
||||
if (auto customVipBadge = this->twitchChannel->ffzCustomVipBadge())
|
||||
{
|
||||
this->emplace<VipBadgeElement>(
|
||||
customVipBadge.get(),
|
||||
MessageElementFlag::BadgeChannelAuthority)
|
||||
->setTooltip((*customVipBadge)->tooltip.string);
|
||||
// early out, since we have to add a custom badge element here
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (badge.flag_ == MessageElementFlag::BadgeSubscription)
|
||||
{
|
||||
auto badgeInfoIt = badgeInfos.find(badge.key_);
|
||||
|
||||
Reference in New Issue
Block a user