diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-14 02:23:18 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-14 02:23:18 -0500 |
| commit | af20d60f42cc2046090c41cafc7f3d651cd0997d (patch) | |
| tree | f0e58ba985b476d26b4e4d37f01f59763ff430de /wordplay.cpp | |
| parent | 8330543f1c1283343f5c9709e24ea0603526cca1 (diff) | |
| download | wordplay-af20d60f42cc2046090c41cafc7f3d651cd0997d.tar.gz wordplay-af20d60f42cc2046090c41cafc7f3d651cd0997d.tar.bz2 wordplay-af20d60f42cc2046090c41cafc7f3d651cd0997d.zip | |
Bot now takes path to config file as argument
That config file now also has to contain the path to the verbly datafile.
Diffstat (limited to 'wordplay.cpp')
| -rw-r--r-- | wordplay.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
| diff --git a/wordplay.cpp b/wordplay.cpp index dedd812..c7015ee 100644 --- a/wordplay.cpp +++ b/wordplay.cpp | |||
| @@ -10,7 +10,14 @@ | |||
| 10 | 10 | ||
| 11 | int main(int argc, char** argv) | 11 | int main(int argc, char** argv) |
| 12 | { | 12 | { |
| 13 | YAML::Node config = YAML::LoadFile("config.yml"); | 13 | if (argc != 2) |
| 14 | { | ||
| 15 | std::cout << "usage: wordplay [configfile]" << std::endl; | ||
| 16 | return -1; | ||
| 17 | } | ||
| 18 | |||
| 19 | std::string configfile(argv[1]); | ||
| 20 | YAML::Node config = YAML::LoadFile(configfile); | ||
| 14 | 21 | ||
| 15 | twitter::auth auth; | 22 | twitter::auth auth; |
| 16 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 23 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
| @@ -20,7 +27,7 @@ int main(int argc, char** argv) | |||
| 20 | 27 | ||
| 21 | twitter::client client(auth); | 28 | twitter::client client(auth); |
| 22 | 29 | ||
| 23 | verbly::data database("data.sqlite3"); | 30 | verbly::data database(config["verbly_datafile"].as<std::string>()); |
| 24 | 31 | ||
| 25 | for (;;) | 32 | for (;;) |
| 26 | { | 33 | { |
