#include #include #include #include #include #include #include int main(int argc, char** argv) { if (argc != 2) { std::cout << "usage: composite [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()); auth.setConsumerSecret(config["consumer_secret"].as()); auth.setAccessKey(config["access_key"].as()); auth.setAccessSecret(config["access_secret"].as()); twitter::client client(auth); verbly::data database(config["verbly_datafile"].as()); for (;;) { std::cout << "Generating..." << std::endl; auto nq = database.nouns().with_stress({{true, false, false}}).random().limit(1).run().front(); std::string noun = nq.singular_form(); noun[0] = std::toupper(noun[0]); std::string output = "Full Metal " + noun; std::cout << output << std::endl; try { client.updateStatus(output); } catch (const twitter::twitter_error& e) { std::cout << "Twitter error: " << e.what() << std::endl; } std::cout << "Waiting..." << std::endl; std::this_thread::sleep_for(std::chrono::hours(1)); } }