summaryrefslogtreecommitdiff
path: root/bot/src/github.hpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-12-13 23:50:45 +0500
committerilotterytea <iltsu@alright.party>2024-12-13 23:50:45 +0500
commit2d40d39264de4eed0bdb9e8e0117a8c1e2f199d3 (patch)
tree890df967067371cd5ddb7b83d733db875a253e7a /bot/src/github.hpp
parentad05411350f1152cc3c86cebb5b8492d34507b33 (diff)
feat: now you can listen to github
Diffstat (limited to 'bot/src/github.hpp')
-rw-r--r--bot/src/github.hpp39
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