diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 18:27:52 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 18:27:52 -0500 |
commit | 7d42f16171533fd9ef19688d39f30cd6774961ec (patch) | |
tree | 5a241d348fa20e00645c8ecfc41231f6da39e599 /blessed.cpp | |
parent | 9ae1d012c365446771310831c8b959c7d8b7efcc (diff) | |
download | blessed-7d42f16171533fd9ef19688d39f30cd6774961ec.tar.gz blessed-7d42f16171533fd9ef19688d39f30cd6774961ec.tar.bz2 blessed-7d42f16171533fd9ef19688d39f30cd6774961ec.zip |
Bot now takes path to config file as argument
That config file now also has to contain the paths to the verbly datafile and the emojis.txt file.
Diffstat (limited to 'blessed.cpp')
-rw-r--r-- | blessed.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/blessed.cpp b/blessed.cpp index 69cc5f3..2649f45 100644 --- a/blessed.cpp +++ b/blessed.cpp | |||
@@ -10,10 +10,18 @@ | |||
10 | 10 | ||
11 | int main(int argc, char** argv) | 11 | int main(int argc, char** argv) |
12 | { | 12 | { |
13 | if (argc != 2) | ||
14 | { | ||
15 | std::cout << "usage: blessed [configfile]" << std::endl; | ||
16 | return -1; | ||
17 | } | ||
18 | |||
19 | std::string configfile(argv[1]); | ||
20 | |||
13 | std::random_device random_device; | 21 | std::random_device random_device; |
14 | std::mt19937 random_engine{random_device()}; | 22 | std::mt19937 random_engine{random_device()}; |
15 | 23 | ||
16 | YAML::Node config = YAML::LoadFile("config.yml"); | 24 | YAML::Node config = YAML::LoadFile(configfile); |
17 | 25 | ||
18 | twitter::auth auth; | 26 | twitter::auth auth; |
19 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 27 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
@@ -23,11 +31,11 @@ int main(int argc, char** argv) | |||
23 | 31 | ||
24 | twitter::client client(auth); | 32 | twitter::client client(auth); |
25 | 33 | ||
26 | verbly::data database {"data.sqlite3"}; | 34 | verbly::data database {config["verbly_datafile"].as<std::string>()}; |
27 | 35 | ||
28 | std::vector<std::string> emojis; | 36 | std::vector<std::string> emojis; |
29 | { | 37 | { |
30 | std::ifstream emojifile("emojis.txt"); | 38 | std::ifstream emojifile(config["emoji_file"].as<std::string>()); |
31 | if (!emojifile.is_open()) | 39 | if (!emojifile.is_open()) |
32 | { | 40 | { |
33 | std::cout << "Could not find emoji." << std::endl; | 41 | std::cout << "Could not find emoji." << std::endl; |