feat: Live Emote Updates for 7TV (#4090)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "providers/irc/Irc2.hpp"
|
||||
#include "providers/seventv/SeventvBadges.hpp"
|
||||
#include "providers/seventv/SeventvEmotes.hpp"
|
||||
#include "providers/seventv/SeventvEventAPI.hpp"
|
||||
#include "providers/twitch/PubSubManager.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
@@ -149,6 +150,8 @@ void Application::initialize(Settings &settings, Paths &paths)
|
||||
this->initNm(paths);
|
||||
}
|
||||
this->initPubSub();
|
||||
|
||||
this->initSeventvEventAPI();
|
||||
}
|
||||
|
||||
int Application::run(QApplication &qtApp)
|
||||
@@ -563,6 +566,53 @@ void Application::initPubSub()
|
||||
RequestModerationActions();
|
||||
}
|
||||
|
||||
void Application::initSeventvEventAPI()
|
||||
{
|
||||
if (!this->twitch->seventvEventAPI)
|
||||
{
|
||||
qCDebug(chatterinoSeventvEventAPI)
|
||||
<< "Skipping initialization as the EventAPI is disabled";
|
||||
return;
|
||||
}
|
||||
|
||||
this->twitch->seventvEventAPI->signals_.emoteAdded.connect(
|
||||
[&](const auto &data) {
|
||||
postToThread([this, data] {
|
||||
this->twitch->forEachSeventvEmoteSet(
|
||||
data.emoteSetID, [data](TwitchChannel &chan) {
|
||||
chan.addSeventvEmote(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
this->twitch->seventvEventAPI->signals_.emoteUpdated.connect(
|
||||
[&](const auto &data) {
|
||||
postToThread([this, data] {
|
||||
this->twitch->forEachSeventvEmoteSet(
|
||||
data.emoteSetID, [data](TwitchChannel &chan) {
|
||||
chan.updateSeventvEmote(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
this->twitch->seventvEventAPI->signals_.emoteRemoved.connect(
|
||||
[&](const auto &data) {
|
||||
postToThread([this, data] {
|
||||
this->twitch->forEachSeventvEmoteSet(
|
||||
data.emoteSetID, [data](TwitchChannel &chan) {
|
||||
chan.removeSeventvEmote(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
this->twitch->seventvEventAPI->signals_.userUpdated.connect(
|
||||
[&](const auto &data) {
|
||||
this->twitch->forEachSeventvUser(data.userID,
|
||||
[data](TwitchChannel &chan) {
|
||||
chan.updateSeventvUser(data);
|
||||
});
|
||||
});
|
||||
|
||||
this->twitch->seventvEventAPI->start();
|
||||
}
|
||||
|
||||
Application *getApp()
|
||||
{
|
||||
assert(Application::instance != nullptr);
|
||||
|
||||
Reference in New Issue
Block a user