From 7d42f16171533fd9ef19688d39f30cd6774961ec Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 13 Dec 2016 18:27:52 -0500 Subject: 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. --- blessed.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'blessed.cpp') diff --git a/blessed.cpp b/blessed.cpp index 69cc5f3..2649f45 100644 --- a/blessed.cpp +++ b/blessed.cpp @@ -10,10 +10,18 @@ int main(int argc, char** argv) { + if (argc != 2) + { + std::cout << "usage: blessed [configfile]" << std::endl; + return -1; + } + + std::string configfile(argv[1]); + std::random_device random_device; std::mt19937 random_engine{random_device()}; - YAML::Node config = YAML::LoadFile("config.yml"); + YAML::Node config = YAML::LoadFile(configfile); twitter::auth auth; auth.setConsumerKey(config["consumer_key"].as()); @@ -23,11 +31,11 @@ int main(int argc, char** argv) twitter::client client(auth); - verbly::data database {"data.sqlite3"}; + verbly::data database {config["verbly_datafile"].as()}; std::vector emojis; { - std::ifstream emojifile("emojis.txt"); + std::ifstream emojifile(config["emoji_file"].as()); if (!emojifile.is_open()) { std::cout << "Could not find emoji." << std::endl; -- cgit 1.4.1