feat: Add Live Emote Updates for BTTV (#4147)
This feature is enabled by default and can be disabled in settings with the "Enable BTTV live emotes updates" setting. Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "debug/AssertInGuiThread.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/bttv/BttvLiveUpdates.hpp"
|
||||
#include "providers/chatterino/ChatterinoBadges.hpp"
|
||||
#include "providers/ffz/FfzBadges.hpp"
|
||||
#include "providers/irc/Irc2.hpp"
|
||||
@@ -156,6 +157,7 @@ void Application::initialize(Settings &settings, Paths &paths)
|
||||
}
|
||||
this->initPubSub();
|
||||
|
||||
this->initBttvLiveUpdates();
|
||||
this->initSeventvEventAPI();
|
||||
}
|
||||
|
||||
@@ -576,6 +578,51 @@ void Application::initPubSub()
|
||||
RequestModerationActions();
|
||||
}
|
||||
|
||||
void Application::initBttvLiveUpdates()
|
||||
{
|
||||
if (!this->twitch->bttvLiveUpdates)
|
||||
{
|
||||
qCDebug(chatterinoBttv)
|
||||
<< "Skipping initialization of Live Updates as it's disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
this->twitch->bttvLiveUpdates->signals_.emoteAdded.connect(
|
||||
[&](const auto &data) {
|
||||
auto chan = this->twitch->getChannelOrEmptyByID(data.channelID);
|
||||
|
||||
postToThread([chan, data] {
|
||||
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||
{
|
||||
channel->addBttvEmote(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
this->twitch->bttvLiveUpdates->signals_.emoteUpdated.connect(
|
||||
[&](const auto &data) {
|
||||
auto chan = this->twitch->getChannelOrEmptyByID(data.channelID);
|
||||
|
||||
postToThread([chan, data] {
|
||||
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||
{
|
||||
channel->updateBttvEmote(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
this->twitch->bttvLiveUpdates->signals_.emoteRemoved.connect(
|
||||
[&](const auto &data) {
|
||||
auto chan = this->twitch->getChannelOrEmptyByID(data.channelID);
|
||||
|
||||
postToThread([chan, data] {
|
||||
if (auto *channel = dynamic_cast<TwitchChannel *>(chan.get()))
|
||||
{
|
||||
channel->removeBttvEmote(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
this->twitch->bttvLiveUpdates->start();
|
||||
}
|
||||
|
||||
void Application::initSeventvEventAPI()
|
||||
{
|
||||
if (!this->twitch->seventvEventAPI)
|
||||
|
||||
Reference in New Issue
Block a user