From 84aebba223b6a8f9eb2d1272c3ed2083d561f2b9 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 22 Jul 2025 23:12:52 +0500 Subject: feat: RSS support --- bot/src/rss.hpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 bot/src/rss.hpp (limited to 'bot/src/rss.hpp') diff --git a/bot/src/rss.hpp b/bot/src/rss.hpp new file mode 100644 index 0000000..cc925ff --- /dev/null +++ b/bot/src/rss.hpp @@ -0,0 +1,57 @@ +#pragma once + +#include +#include +#include +#include + +#include "api/twitch/helix_client.hpp" +#include "config.hpp" +#include "irc/client.hpp" + +namespace bot { + struct RSSMessage { + std::string title, id, message; + long timestamp; + }; + + struct RSSEvent { + std::string name; + int type; + }; + + struct RSSChannel { + std::string name, url; + std::optional event; + std::vector messages; + + sol::table as_lua_table(std::shared_ptr state) const; + }; + + class RSSListener { + public: + RSSListener(irc::Client &irc_client, + api::twitch::HelixClient &helix_client, + Configuration &configuration) + : irc_client(irc_client), + helix_client(helix_client), + configuration(configuration) {}; + ~RSSListener() = default; + + void run(); + void add_channel(const std::string &url); + void remove_channel(const std::string &url); + bool has_channel(const std::string &url) const; + + private: + void add_channels(); + void check_channels(); + + std::vector channels; + irc::Client &irc_client; + api::twitch::HelixClient &helix_client; + Configuration &configuration; + }; + + std::optional get_rss_channel(const std::string &url); +} \ No newline at end of file -- cgit v1.2.3