summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9593863..c7e8e2f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,7 @@
#include <iostream>
#include <optional>
+#include <pqxx/pqxx>
+#include <string>
#include "bundle.hpp"
#include "commands/command.hpp"
@@ -40,6 +42,19 @@ int main(int argc, char *argv[]) {
client.join(cfg.bot_username);
+ pqxx::connection conn(GET_DATABASE_CONNECTION_URL(cfg));
+ pqxx::work work(conn);
+
+ auto rows = work.exec("SELECT alias_name FROM channels");
+
+ for (const auto &row : rows) {
+ auto name = row[0].as<std::string>();
+ client.join(name);
+ }
+
+ work.commit();
+ conn.close();
+
client.on<bot::irc::MessageType::Privmsg>(
[&client, &command_loader, &localization](
const bot::irc::Message<bot::irc::MessageType::Privmsg> &message) {