diff options
author | Max Kusatz <max@trialserver.de> | 2020-10-29 20:51:02 +0100 |
---|---|---|
committer | Max Kusatz <max@trialserver.de> | 2020-10-29 20:51:02 +0100 |
commit | 6cbf8dd21c65ea201694eb201bbbcc53ca7921db (patch) | |
tree | 5f1c15de7a9ed5c46d8e92b0a75fe6f7e8748aed | |
parent | 8eed7cecf237f22aa017401dd18bf99af1dfb0da (diff) | |
download | n_frontend_telegram-6cbf8dd21c65ea201694eb201bbbcc53ca7921db.tar.gz n_frontend_telegram-6cbf8dd21c65ea201694eb201bbbcc53ca7921db.zip |
updated Readme
-rw-r--r-- | Readme.md | 17 | ||||
-rw-r--r-- | main.cpp | 6 |
2 files changed, 18 insertions, 5 deletions
@@ -1,6 +1,19 @@ ### N Telegram -## Installation +## Prerequisites You need CPR (https://github.com/whoshuu/cpr) and tgbot-cpp (https://github.com/reo7sp/tgbot-cpp) installed as shown in their pages. -
\ No newline at end of file +## Building + mkdir build + cd build + cmake .. + make -j6 + +##Config +Your config.toml file should look somthing like this: + + [telegram] + apikey="insert Key here" + + [n_core] + adress="host:port" @@ -19,6 +19,8 @@ int main() { std::istringstream msg(message->text); std::string command, commandtmp, arguments; + std::cout << "incomming Message: " << message->text << " from " << message->chat->username << "\n"; + std::getline(msg, commandtmp, ' '); std::getline(msg, arguments); //std::cout << "command: " << commandtmp << "\n"; @@ -33,7 +35,6 @@ int main() { request["arguments"] = arguments; request["session"] = std::to_string(message->from->id); - //std::cout << request.dump() << "\n"; cpr::Response r = cpr::Post(cpr::Url{config["n_core"]["adress"].value_or("localhost:18080")}, cpr::Body{request.dump()}); @@ -42,7 +43,6 @@ int main() { return 1; } - //std::cout << r.text << "\n"; auto jreply = json::parse(r.text); @@ -75,7 +75,7 @@ int main() { } else { bot.getApi().sendMessage(message->chat->id, "Command was not successfully executed."); } - + return 0; }); try { |