diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-30 11:35:32 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-30 11:35:32 -0400 |
| commit | 95cd6e298cf6b80476fdcec08c5249ff4530bb16 (patch) | |
| tree | a1e654a7619567e9f7a917bbf95d65a76c23e0eb /composite.cpp | |
| download | composite-95cd6e298cf6b80476fdcec08c5249ff4530bb16.tar.gz composite-95cd6e298cf6b80476fdcec08c5249ff4530bb16.tar.bz2 composite-95cd6e298cf6b80476fdcec08c5249ff4530bb16.zip | |
Initial commit
Diffstat (limited to 'composite.cpp')
| -rw-r--r-- | composite.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
| diff --git a/composite.cpp b/composite.cpp new file mode 100644 index 0000000..891f179 --- /dev/null +++ b/composite.cpp | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #include <verbly.h> | ||
| 2 | #include <yaml-cpp/yaml.h> | ||
| 3 | #include <twitter.h> | ||
| 4 | #include <chrono> | ||
| 5 | #include <string> | ||
| 6 | #include <thread> | ||
| 7 | #include <iostream> | ||
| 8 | |||
| 9 | int main(int argc, char** argv) | ||
| 10 | { | ||
| 11 | YAML::Node config = YAML::LoadFile("config.yml"); | ||
| 12 | |||
| 13 | twitter::auth auth; | ||
| 14 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | ||
| 15 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | ||
| 16 | auth.setAccessKey(config["access_key"].as<std::string>()); | ||
| 17 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | ||
| 18 | |||
| 19 | twitter::client client(auth); | ||
| 20 | verbly::data database("data.sqlite3"); | ||
| 21 | |||
| 22 | for (;;) | ||
| 23 | { | ||
| 24 | std::cout << "Generating..." << std::endl; | ||
| 25 | auto nq = database.nouns().with_stress({{true, false, false}}).random().limit(1).run().front(); | ||
| 26 | std::string output = "full metal " + nq.singular_form(); | ||
| 27 | std::cout << output << std::endl; | ||
| 28 | |||
| 29 | twitter::tweet sent; | ||
| 30 | twitter::response resp = client.updateStatus(output, sent); | ||
| 31 | if (resp != twitter::response::ok) | ||
| 32 | { | ||
| 33 | std::cout << "Twitter error: " << resp << std::endl; | ||
| 34 | } | ||
| 35 | |||
| 36 | std::cout << "Waiting..." << std::endl; | ||
| 37 | std::this_thread::sleep_for(std::chrono::hours(1)); | ||
| 38 | } | ||
| 39 | } \ No newline at end of file | ||
