diff options
Diffstat (limited to 'bot/src/github.hpp')
| -rw-r--r-- | bot/src/github.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
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 <string> +#include <unordered_map> +#include <vector> + +#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<std::string, std::vector<Commit>> check_new_commits(); + void notify_about_commits( + const std::unordered_map<std::string, std::vector<Commit>> + &new_commits); + + std::vector<std::string> ids; + std::unordered_map<std::string, std::vector<std::string>> commits; + + irc::Client &irc_client; + const Configuration &configuration; + }; +}
\ No newline at end of file |
