diff options
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; |
