Fetch FFZ channel emotes with channel id instead of name

This commit is contained in:
apa420
2019-08-27 18:45:55 +00:00
committed by fourtf
parent 450f3bc492
commit a624d14a4f
8 changed files with 41 additions and 23 deletions
+11 -6
View File
@@ -22,7 +22,7 @@ ChatroomChannel::ChatroomChannel(const QString &channelName,
}
}
void ChatroomChannel::refreshChannelEmotes()
void ChatroomChannel::refreshBTTVChannelEmotes()
{
if (this->chatroomOwnerId.isEmpty())
{
@@ -36,17 +36,22 @@ void ChatroomChannel::refreshChannelEmotes()
this->bttvEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
});
FfzEmotes::loadChannel(username, [this, weak](auto &&emoteMap) {
if (auto shared = weak.lock())
this->ffzEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
});
if (auto shared = weak.lock())
{
this->chatroomOwnerName = username;
}
});
}
void ChatroomChannel::refreshFFZChannelEmotes()
{
if (this->chatroomOwnerId.isEmpty())
{
return;
}
FfzEmotes::loadChannel(this->chatroomOwnerId, [this](auto &&emoteMap) {
this->ffzEmotes_.set(std::make_shared<EmoteMap>(std::move(emoteMap)));
});
}
const QString &ChatroomChannel::getDisplayName() const
{
+2 -1
View File
@@ -13,7 +13,8 @@ protected:
explicit ChatroomChannel(const QString &channelName,
TwitchBadges &globalTwitchBadges,
BttvEmotes &globalBttv, FfzEmotes &globalFfz);
virtual void refreshChannelEmotes() override;
virtual void refreshBTTVChannelEmotes() override;
virtual void refreshFFZChannelEmotes() override;
virtual const QString &getDisplayName() const override;
QString chatroomOwnerId;
+8 -3
View File
@@ -113,6 +113,7 @@ TwitchChannel::TwitchChannel(const QString &name,
this->refreshLiveStatus();
this->refreshBadges();
this->refreshCheerEmotes();
this->refreshFFZChannelEmotes();
});
// timers
@@ -135,7 +136,7 @@ TwitchChannel::TwitchChannel(const QString &name,
void TwitchChannel::initialize()
{
this->refreshChatters();
this->refreshChannelEmotes();
this->refreshBTTVChannelEmotes();
this->refreshBadges();
this->ffzCustomModBadge_.loadCustomModBadge();
}
@@ -150,7 +151,7 @@ bool TwitchChannel::canSendMessage() const
return !this->isEmpty();
}
void TwitchChannel::refreshChannelEmotes()
void TwitchChannel::refreshBTTVChannelEmotes()
{
BttvEmotes::loadChannel(
this->getName(), [this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
@@ -158,8 +159,12 @@ void TwitchChannel::refreshChannelEmotes()
this->bttvEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
});
}
void TwitchChannel::refreshFFZChannelEmotes()
{
FfzEmotes::loadChannel(
this->getName(), [this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
this->roomId(), [this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
if (auto shared = weak.lock())
this->ffzEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
+2 -1
View File
@@ -85,7 +85,8 @@ public:
std::shared_ptr<const EmoteMap> bttvEmotes() const;
std::shared_ptr<const EmoteMap> ffzEmotes() const;
virtual void refreshChannelEmotes();
virtual void refreshBTTVChannelEmotes();
virtual void refreshFFZChannelEmotes();
// Badges
boost::optional<EmotePtr> ffzCustomModBadge() const;