From 95cd6e298cf6b80476fdcec08c5249ff4530bb16 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 30 May 2016 11:35:32 -0400 Subject: Initial commit --- composite.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 composite.cpp (limited to 'composite.cpp') diff --git a/composite.cpp b/composite.cpp new file mode 100644 index 0000000..891f179 --- /dev/null +++ b/composite.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + YAML::Node config = YAML::LoadFile("config.yml"); + + 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("data.sqlite3"); + + for (;;) + { + std::cout << "Generating..." << std::endl; + auto nq = database.nouns().with_stress({{true, false, false}}).random().limit(1).run().front(); + std::string output = "full metal " + nq.singular_form(); + std::cout << output << std::endl; + + twitter::tweet sent; + twitter::response resp = client.updateStatus(output, sent); + if (resp != twitter::response::ok) + { + std::cout << "Twitter error: " << resp << std::endl; + } + + std::cout << "Waiting..." << std::endl; + std::this_thread::sleep_for(std::chrono::hours(1)); + } +} \ No newline at end of file -- cgit 1.4.1