aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8a8e4ba..948bc1d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,40 +25,41 @@ int main() {
};
// command --> handler
- std::vector<Handler::CommandHandler> commands;
- commands.emplace_back(
+ std::vector<Handler::CommandHandler> regular_commands;
+ regular_commands.emplace_back(
Handler::CommandHandler{"wiki", Handler::wikiHandler, [createPlainDescriptionFromText]() {
return createPlainDescriptionFromText("Sends you to Wikipedia!");
}});
- commands.emplace_back(
+ regular_commands.emplace_back(
Handler::CommandHandler{"stop", Handler::stopHandler, [createPlainDescriptionFromText]() {
return createPlainDescriptionFromText("Stops the bot");
}, &app});
- commands.emplace_back(
+ regular_commands.emplace_back(
Handler::CommandHandler{"mensa", Handler::mensaHandler, [createPlainDescriptionFromText]() {
return createPlainDescriptionFromText(
"{adlershof, nord, sued} Shows the daily menu of the mensa at various places.");
}});
- commands.emplace_back(
+ regular_commands.emplace_back(
Handler::CommandHandler{"klinger", Handler::klingerHandler, [createPlainDescriptionFromText]() {
return createPlainDescriptionFromText("Greats in french. Bonjour!");
}});
- commands.emplace_back(
+ regular_commands.emplace_back(
Handler::CommandHandler{"say", Handler::sayHandler, [createPlainDescriptionFromText]() {
return createPlainDescriptionFromText("Say something!");
}});
- commands.emplace_back(
+ regular_commands.emplace_back(
Handler::CommandHandler{"relation", Handler::relationShipHandler, [createPlainDescriptionFromText]() {
return 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.emplace_back(Handler::CommandHandler{"help", Handler::helpHandler, [createPlainDescriptionFromText]() {
- return createPlainDescriptionFromText("This is my holy manual.");
- }, &commands});
+ regular_commands.emplace_back(
+ Handler::CommandHandler{"help", Handler::helpHandler, [createPlainDescriptionFromText]() {
+ return createPlainDescriptionFromText("This is my holy manual.");
+ }, &regular_commands});
CROW_ROUTE(app, "/")
.methods("POST"_method)
- ([&commands](crow::request const &request) {
+ ([&regular_commands](crow::request const &request) {
auto data = crow::json::load(request.body);
if (!data)
@@ -73,12 +74,13 @@ int main() {
std::string session = (data.count("session") ? data["session"].s() : std::string("null"));
auto itor = std::find_if(
- commands.begin(),
- commands.end(),
+ regular_commands.begin(),
+ regular_commands.end(),
[command](Handler::CommandHandler const &handler) {
return handler.command == command;
});
- if (itor != commands.end()) {
+
+ if (itor != regular_commands.end()) {
return crow::response{itor->exec(arguments, session)};
}