From 2d40d39264de4eed0bdb9e8e0117a8c1e2f199d3 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Fri, 13 Dec 2024 23:50:45 +0500 Subject: feat: now you can listen to github --- bot/src/github.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 bot/src/github.hpp (limited to 'bot/src/github.hpp') diff --git a/bot/src/github.hpp b/bot/src/github.hpp new file mode 100644 index 0000000..8014706 --- /dev/null +++ b/bot/src/github.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include + +#include "config.hpp" +#include "irc/client.hpp" + +namespace bot { + struct Commit { + std::string sha; + std::string commiter_name; + std::string message; + }; + + class GithubListener { + public: + GithubListener(const Configuration &configuration, + irc::Client &irc_client) + : configuration(configuration), irc_client(irc_client){}; + ~GithubListener(){}; + + void run(); + + private: + void check_for_listeners(); + std::unordered_map> check_new_commits(); + void notify_about_commits( + const std::unordered_map> + &new_commits); + + std::vector ids; + std::unordered_map> commits; + + irc::Client &irc_client; + const Configuration &configuration; + }; +} \ No newline at end of file -- cgit v1.2.3