diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 19:07:19 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 19:07:19 -0500 |
commit | 41caebf71f6fb937ae42766622bdb1642f032c08 (patch) | |
tree | 73a482203ec99f1b3b598a9d88ca5f32d647fc21 /furries.cpp | |
parent | 793559182f0ed010ca2619e68c36fece491c70e0 (diff) | |
download | furries-41caebf71f6fb937ae42766622bdb1642f032c08.tar.gz furries-41caebf71f6fb937ae42766622bdb1642f032c08.tar.bz2 furries-41caebf71f6fb937ae42766622bdb1642f032c08.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 'furries.cpp')
-rw-r--r-- | furries.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/furries.cpp b/furries.cpp index 7e2f591..de2fa02 100644 --- a/furries.cpp +++ b/furries.cpp | |||
@@ -432,11 +432,18 @@ class fill_blanks { | |||
432 | 432 | ||
433 | int main(int argc, char** argv) | 433 | int main(int argc, char** argv) |
434 | { | 434 | { |
435 | if (argc != 2) | ||
436 | { | ||
437 | std::cout << "usage: furries [configfile]" << std::endl; | ||
438 | return -1; | ||
439 | } | ||
440 | |||
441 | std::string configfile(argv[1]); | ||
442 | YAML::Node config = YAML::LoadFile(configfile); | ||
443 | |||
435 | std::random_device random_device; | 444 | std::random_device random_device; |
436 | std::mt19937 random_engine{random_device()}; | 445 | std::mt19937 random_engine{random_device()}; |
437 | 446 | ||
438 | YAML::Node config = YAML::LoadFile("config.yml"); | ||
439 | |||
440 | twitter::auth auth; | 447 | twitter::auth auth; |
441 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 448 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
442 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | 449 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); |
@@ -444,7 +451,7 @@ int main(int argc, char** argv) | |||
444 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | 451 | auth.setAccessSecret(config["access_secret"].as<std::string>()); |
445 | 452 | ||
446 | twitter::client client(auth); | 453 | twitter::client client(auth); |
447 | verbly::data database {"data.sqlite3"}; | 454 | verbly::data database {config["verbly_datafile"].as<std::string>()}; |
448 | 455 | ||
449 | for (;;) | 456 | for (;;) |
450 | { | 457 | { |