custom ffz moderator badges (#827)
This commit is contained in:
@@ -91,6 +91,7 @@ TwitchChannel::TwitchChannel(const QString &name,
|
||||
, globalFfz_(ffz)
|
||||
, bttvEmotes_(std::make_shared<EmoteMap>())
|
||||
, ffzEmotes_(std::make_shared<EmoteMap>())
|
||||
, ffzCustomModBadge_(name)
|
||||
, mod_(false)
|
||||
{
|
||||
log("[TwitchChannel:{}] Opened", name);
|
||||
@@ -143,6 +144,7 @@ void TwitchChannel::initialize()
|
||||
{
|
||||
this->refreshChatters();
|
||||
this->refreshChannelEmotes();
|
||||
this->ffzCustomModBadge_.loadCustomModBadge();
|
||||
}
|
||||
|
||||
bool TwitchChannel::isEmpty() const
|
||||
@@ -783,4 +785,12 @@ boost::optional<EmotePtr> TwitchChannel::twitchBadge(
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
boost::optional<EmotePtr> TwitchChannel::ffzCustomModBadge() const
|
||||
{
|
||||
if (auto badge = this->ffzCustomModBadge_.badge())
|
||||
return badge;
|
||||
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "common/Outcome.hpp"
|
||||
#include "common/UniqueAccess.hpp"
|
||||
#include "common/UsernameSet.hpp"
|
||||
#include "providers/ffz/FfzModBadge.hpp"
|
||||
#include "providers/twitch/TwitchEmotes.hpp"
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
@@ -84,6 +85,7 @@ public:
|
||||
void refreshChannelEmotes();
|
||||
|
||||
// Badges
|
||||
boost::optional<EmotePtr> ffzCustomModBadge() const;
|
||||
boost::optional<EmotePtr> twitchBadge(const QString &set,
|
||||
const QString &version) const;
|
||||
|
||||
@@ -141,6 +143,7 @@ private:
|
||||
UniqueAccess<std::map<QString, std::map<QString, EmotePtr>>>
|
||||
badgeSets_; // "subscribers": { "0": ... "3": ... "6": ...
|
||||
UniqueAccess<std::vector<CheerEmoteSet>> cheerEmoteSets_;
|
||||
FfzModBadge ffzCustomModBadge_;
|
||||
|
||||
bool mod_ = false;
|
||||
UniqueAccess<QString> roomID_;
|
||||
|
||||
@@ -1107,7 +1107,14 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||
}
|
||||
else if (badge == "moderator/1")
|
||||
{
|
||||
// TODO: Implement custom FFZ moderator badge
|
||||
if (auto customModBadge = this->twitchChannel->ffzCustomModBadge())
|
||||
{
|
||||
this->emplace<EmoteElement>(
|
||||
customModBadge.get(),
|
||||
MessageElementFlag::BadgeChannelAuthority)
|
||||
->setTooltip((*customModBadge)->tooltip.string);
|
||||
continue;
|
||||
}
|
||||
this->emplace<ImageElement>(
|
||||
Image::fromPixmap(app->resources->twitch.moderator),
|
||||
MessageElementFlag::BadgeChannelAuthority)
|
||||
|
||||
Reference in New Issue
Block a user