From 0f2802b3c8f3d1096df7ac483eba390ae952e13f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 14 Dec 2016 02:30:14 -0500 Subject: Bot now takes path to config file as argument That config file now also has to contain the path to the forms file. --- yandere.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'yandere.cpp') diff --git a/yandere.cpp b/yandere.cpp index ec7322d..b9d42ec 100644 --- a/yandere.cpp +++ b/yandere.cpp @@ -51,7 +51,14 @@ Container split(std::string input, std::string delimiter) int main(int argc, char** argv) { - YAML::Node config = YAML::LoadFile("config.yml"); + if (argc != 2) + { + std::cout << "usage: yandere [configfile]" << std::endl; + return -1; + } + + std::string configfile(argv[1]); + YAML::Node config = YAML::LoadFile(configfile); twitter::auth auth; auth.setConsumerKey(config["consumer_key"].as()); @@ -62,10 +69,10 @@ int main(int argc, char** argv) twitter::client client(auth); std::map> groups; - std::ifstream datafile("data.txt"); + std::ifstream datafile(config["forms"].as()); if (!datafile.is_open()) { - std::cout << "Could not find data.txt" << std::endl; + std::cout << "Could not find forms file." << std::endl; return 1; } -- cgit 1.4.1