diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-18 16:25:28 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-18 16:25:28 +0500 |
| commit | 9b1a11e8fee33abb933aa3836faf60cc14deb68d (patch) | |
| tree | b94a90a53f89e62e4aac770d97ead73a97072d76 /bot/src/main.cpp | |
| parent | 4827c87c986d217a940ce87cc31245440d6b1ab6 (diff) | |
feat: betterttv clients (experimental)
Diffstat (limited to 'bot/src/main.cpp')
| -rw-r--r-- | bot/src/main.cpp | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/bot/src/main.cpp b/bot/src/main.cpp index 733c0eb..c98841b 100644 --- a/bot/src/main.cpp +++ b/bot/src/main.cpp @@ -62,6 +62,9 @@ int main(int argc, char *argv[]) { bot::api::twitch::HelixClient helix_client(cfg.twitch_credentials.token, cfg.twitch_credentials.client_id); +#ifdef BUILD_BETTERTTV + emotespp::BetterTTVWebsocketClient bttv_ws_client; +#endif emotespp::SevenTVWebsocketClient seventv_emote_listener; emotespp::SevenTVAPIClient seventv_api_client; @@ -115,9 +118,18 @@ int main(int argc, char *argv[]) { bot::GithubListener github_listener(cfg, client, helix_client); - bot::emotes::EmoteEventBundle emote_bundle{ - client, helix_client, seventv_emote_listener, seventv_api_client, cfg}; - + bot::emotes::EmoteEventBundle emote_bundle{client, + helix_client, +#ifdef BUILD_BETTERTTV + bttv_ws_client, +#endif + seventv_emote_listener, + seventv_api_client, + cfg}; + + // --------------- + // 7TV !!! + // --------------- seventv_emote_listener.on_emote_create( [&emote_bundle](const std::string &channel_name, const std::optional<std::string> &author_id, @@ -147,6 +159,42 @@ int main(int argc, char *argv[]) { seventv_emote_listener.start(); +#ifdef BUILD_BETTERTTV + // ---------------- + // BETTERTTV + // ---------------- + + bttv_ws_client.on_emote_create( + [&emote_bundle](const std::string &channel_name, + const std::optional<std::string> &author_id, + const emotespp::Emote &emote) { + bot::emotes::handle_emote_event(emote_bundle, + bot::schemas::BTTV_EMOTE_CREATE, + channel_name, author_id, emote); + }); + + bttv_ws_client.on_emote_delete( + [&emote_bundle](const std::string &channel_name, + const std::optional<std::string> &author_id, + const emotespp::Emote &emote) { + bot::emotes::handle_emote_event(emote_bundle, + bot::schemas::BTTV_EMOTE_DELETE, + channel_name, author_id, emote); + }); + + bttv_ws_client.on_emote_update( + [&emote_bundle](const std::string &channel_name, + const std::optional<std::string> &author_id, + const emotespp::Emote &emote) { + bot::emotes::handle_emote_event(emote_bundle, + bot::schemas::BTTV_EMOTE_UPDATE, + channel_name, author_id, emote); + }); + + bttv_ws_client.start(); + +#endif + client.on<bot::irc::MessageType::Privmsg>( [&client, &command_loader, &localization, &cfg, &helix_client]( const bot::irc::Message<bot::irc::MessageType::Privmsg> &message) { |
