diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-01-10 10:56:45 -0500 | 
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-01-10 10:56:45 -0500 | 
| commit | 6035e62b8935130a1ad213163510f881f6ded0e4 (patch) | |
| tree | e9636210c9caa353e066087ffc74177cc1d0c5f5 | |
| parent | a56e585703a12e30af6b62e5e6ac8a9891d7610f (diff) | |
| download | owo-6035e62b8935130a1ad213163510f881f6ded0e4.tar.gz owo-6035e62b8935130a1ad213163510f881f6ded0e4.tar.bz2 owo-6035e62b8935130a1ad213163510f881f6ded0e4.zip | |
Updated to the new verbly (which is a few years old at this point)
| -rw-r--r-- | owo.cpp | 43 | ||||
| m--------- | vendor/verbly | 0 | 
2 files changed, 24 insertions, 19 deletions
| diff --git a/owo.cpp b/owo.cpp index f66e689..ec9ffbb 100644 --- a/owo.cpp +++ b/owo.cpp | |||
| @@ -16,33 +16,38 @@ int main(int argc, char** argv) | |||
| 16 | 16 | ||
| 17 | std::string configfile(argv[1]); | 17 | std::string configfile(argv[1]); | 
| 18 | YAML::Node config = YAML::LoadFile(configfile); | 18 | YAML::Node config = YAML::LoadFile(configfile); | 
| 19 | 19 | ||
| 20 | twitter::auth auth; | 20 | twitter::auth auth; | 
| 21 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 21 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 
| 22 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | 22 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | 
| 23 | auth.setAccessKey(config["access_key"].as<std::string>()); | 23 | auth.setAccessKey(config["access_key"].as<std::string>()); | 
| 24 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | 24 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | 
| 25 | 25 | ||
| 26 | twitter::client client(auth); | 26 | twitter::client client(auth); | 
| 27 | 27 | ||
| 28 | verbly::data database {config["verbly_datafile"].as<std::string>()}; | 28 | verbly::database database {config["verbly_datafile"].as<std::string>()}; | 
| 29 | 29 | ||
| 30 | verbly::noun bp = database.nouns().with_wnid(105220461).run().front(); // body part | 30 | verbly::filter nounFilter = | 
| 31 | verbly::noun pp = database.nouns().with_wnid(104723816).run().front(); // quality | 31 | (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) | 
| 32 | verbly::noun cp = database.nouns().with_wnid(103051540).run().front(); // clothing | 32 | && (verbly::form::proper == false) | 
| 33 | verbly::filter<verbly::noun> filt {bp, pp, cp}; | 33 | && (verbly::notion::fullHypernyms %= ( | 
| 34 | filt.set_orlogic(true); | 34 | (verbly::notion::wnid == 105220461) // body part | 
| 35 | 35 | || (verbly::notion::wnid == 104723816) // quality | |
| 36 | || (verbly::notion::wnid == 103051540))); // clothing | ||
| 37 | |||
| 36 | for (;;) | 38 | for (;;) | 
| 37 | { | 39 | { | 
| 38 | std::cout << "Generating tweet" << std::endl; | 40 | std::cout << "Generating tweet" << std::endl; | 
| 39 | 41 | ||
| 40 | auto ns = database.nouns().full_hyponym_of(filt).is_not_proper().random().limit(1).run(); | 42 | verbly::word noun = database.words(nounFilter).first(); | 
| 41 | verbly::noun n = ns.front(); | 43 | verbly::token action = { | 
| 42 | 44 | verbly::token::quote("*", "*", { "notices ur", noun }), | |
| 43 | std::string result = "*notices ur " + n.base_form() + "* OwO whats this..?"; | 45 | "OwO whats this..?" | 
| 46 | }; | ||
| 47 | |||
| 48 | std::string result = action.compile(); | ||
| 44 | result.resize(140); | 49 | result.resize(140); | 
| 45 | 50 | ||
| 46 | try | 51 | try | 
| 47 | { | 52 | { | 
| 48 | client.updateStatus(result); | 53 | client.updateStatus(result); | 
| @@ -50,9 +55,9 @@ int main(int argc, char** argv) | |||
| 50 | { | 55 | { | 
| 51 | std::cout << "Twitter error: " << e.what() << std::endl; | 56 | std::cout << "Twitter error: " << e.what() << std::endl; | 
| 52 | } | 57 | } | 
| 53 | 58 | ||
| 54 | std::cout << result << std::endl; | 59 | std::cout << result << std::endl; | 
| 55 | 60 | ||
| 56 | std::this_thread::sleep_for(std::chrono::hours(1)); | 61 | std::this_thread::sleep_for(std::chrono::hours(1)); | 
| 57 | } | 62 | } | 
| 58 | } | 63 | } | 
| diff --git a/vendor/verbly b/vendor/verbly | |||
| Subproject 1f898f3bd66c29672275c2c884b17ba662ced62 | Subproject 84bae572d353b03ecb3498df83ba301a456b6c6 | ||
