diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-22 23:12:52 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-22 23:12:52 +0500 |
| commit | 84aebba223b6a8f9eb2d1272c3ed2083d561f2b9 (patch) | |
| tree | 02ae6f5798617074cf6ea095669c15d0ca48a402 /bot/src/rss.hpp | |
| parent | 8b86e9a8f071a1af5ce1531a9ebd2b2140e73ff7 (diff) | |
feat: RSS support
Diffstat (limited to 'bot/src/rss.hpp')
| -rw-r--r-- | bot/src/rss.hpp | 57 |
1 files changed, 57 insertions, 0 deletions
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 <optional> +#include <sol/sol.hpp> +#include <string> +#include <vector> + +#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<RSSEvent> event; + std::vector<RSSMessage> messages; + + sol::table as_lua_table(std::shared_ptr<sol::state> 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<RSSChannel> channels; + irc::Client &irc_client; + api::twitch::HelixClient &helix_client; + Configuration &configuration; + }; + + std::optional<RSSChannel> get_rss_channel(const std::string &url); +}
\ No newline at end of file |
