feat: add initial experimental Twitch Eventsub support (#5837)

Co-authored-by: nerix <nerixdev@outlook.de>
This commit is contained in:
pajlada
2025-02-02 17:03:24 +01:00
committed by GitHub
parent f9f7d47b43
commit 0f8a29fdb9
130 changed files with 19656 additions and 8 deletions
+22
View File
@@ -18,6 +18,7 @@
#include "providers/pronouns/Pronouns.hpp"
#include "providers/seventv/SeventvAPI.hpp"
#include "providers/seventv/SeventvEmotes.hpp"
#include "providers/twitch/eventsub/Controller.hpp"
#include "providers/twitch/TwitchBadges.hpp"
#include "singletons/ImageUploader.hpp"
#ifdef CHATTERINO_HAVE_PLUGINS
@@ -120,6 +121,18 @@ SeventvEventAPI *makeSeventvEventAPI(Settings &settings)
return nullptr;
}
eventsub::IController *makeEventSubController(Settings &settings)
{
bool enabled = settings.enableExperimentalEventSub;
if (enabled)
{
return new eventsub::Controller();
}
return new eventsub::DummyController();
}
const QString TWITCH_PUBSUB_URL = "wss://pubsub-edge.twitch.tv";
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
@@ -180,6 +193,7 @@ Application::Application(Settings &_settings, const Paths &paths,
, streamerMode(new StreamerMode)
, twitchUsers(new TwitchUsers)
, pronouns(new pronouns::Pronouns)
, eventSub(makeEventSubController(_settings))
#ifdef CHATTERINO_HAVE_PLUGINS
, plugins(new PluginController(paths))
#endif
@@ -576,6 +590,14 @@ pronouns::Pronouns *Application::getPronouns()
return this->pronouns.get();
}
eventsub::IController *Application::getEventSub()
{
assertInGuiThread();
assert(this->eventSub);
return this->eventSub.get();
}
void Application::save()
{
this->commands->save();