aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 72fd9a0..59fd6a1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,9 +1,10 @@
+#include <queue>
+#include <string>
+#include <vector>
#include <iostream>
-#include <functional>
#include <unordered_map>
#include "crow.h"
-#include "sqdb.hpp"
#include "Handler.hpp"
#include "Response.hpp"
@@ -18,17 +19,23 @@
int main() {
crow::SimpleApp app;
+ auto createPlainDescriptionFromText = [] (std::string const &text) -> std::queue<crow::json::wvalue>* {
+ auto reply_queue = new std::queue<crow::json::wvalue>;
+ reply_queue->emplace(Response::create_text(text));
+ return reply_queue;
+ };
+
// command --> handler
std::unordered_map<std::string, Handler::CommandHandler> commands{
- {"wiki", {.func = Handler::wikiHandler, .description = "Send you to wikipedia"}},
- {"stop", {.func = Handler::stopHandler, .description = "Stops the bot", .payload = &app}},
- {"mensa", {.func = Handler::mensaHandler, .description = "{adlershof, nord, sued} Shows the daily menu of the mensa at various places."}},
- {"klinger", {.func = Handler::klingerHandler, .description = "Greats in french. Bonjour!"}},
- {"relation", {.func = Handler::relationShipHandler, .description = "[name1] [name2] Shows the result of an odd astrological religious pseudo-algorithm, based on the fact how much blessing a relationship receives by the glorious N."}},
+ {"wiki", {.func = Handler::wikiHandler, .description = createPlainDescriptionFromText("Sends you to Wikipedia!")}},
+ {"stop", {.func = Handler::stopHandler, .description = createPlainDescriptionFromText("Stops the bot"), .payload = &app}},
+ {"mensa", {.func = Handler::mensaHandler, .description = createPlainDescriptionFromText("{adlershof, nord, sued} Shows the daily menu of the mensa at various places.")}},
+ {"klinger", {.func = Handler::klingerHandler, .description = createPlainDescriptionFromText("Greats in french. Bonjour!")}},
+ {"relation", {.func = Handler::relationShipHandler, .description = createPlainDescriptionFromText("[name1] [name2] Shows the result of an odd astrological religious pseudo-algorithm, based on the fact how much blessing a relationship receives by the glorious N.")}},
};
commands.insert({"help",
- {.func = Handler::helpHandler, .description = "This is my holy manual.", .payload = &commands}});
+ {.func = Handler::helpHandler, .description = createPlainDescriptionFromText("This is my holy manual."), .payload = &commands}});
CROW_ROUTE(app, "/")
.methods("POST"_method)