diff options
Diffstat (limited to 'owo.cpp')
-rw-r--r-- | owo.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/owo.cpp b/owo.cpp deleted file mode 100644 index f66e689..0000000 --- a/owo.cpp +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #include <yaml-cpp/yaml.h> | ||
2 | #include <iostream> | ||
3 | #include <sstream> | ||
4 | #include <twitter.h> | ||
5 | #include <verbly.h> | ||
6 | #include <chrono> | ||
7 | #include <thread> | ||
8 | |||
9 | int main(int argc, char** argv) | ||
10 | { | ||
11 | if (argc != 2) | ||
12 | { | ||
13 | std::cout << "usage: owo [configfile]" << std::endl; | ||
14 | return -1; | ||
15 | } | ||
16 | |||
17 | std::string configfile(argv[1]); | ||
18 | YAML::Node config = YAML::LoadFile(configfile); | ||
19 | |||
20 | twitter::auth auth; | ||
21 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | ||
22 | auth.setConsumerSecret(config["consumer_secret"].as<std::string>()); | ||
23 | auth.setAccessKey(config["access_key"].as<std::string>()); | ||
24 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | ||
25 | |||
26 | twitter::client client(auth); | ||
27 | |||
28 | verbly::data database {config["verbly_datafile"].as<std::string>()}; | ||
29 | |||
30 | verbly::noun bp = database.nouns().with_wnid(105220461).run().front(); // body part | ||
31 | verbly::noun pp = database.nouns().with_wnid(104723816).run().front(); // quality | ||
32 | verbly::noun cp = database.nouns().with_wnid(103051540).run().front(); // clothing | ||
33 | verbly::filter<verbly::noun> filt {bp, pp, cp}; | ||
34 | filt.set_orlogic(true); | ||
35 | |||
36 | for (;;) | ||
37 | { | ||
38 | std::cout << "Generating tweet" << std::endl; | ||
39 | |||
40 | auto ns = database.nouns().full_hyponym_of(filt).is_not_proper().random().limit(1).run(); | ||
41 | verbly::noun n = ns.front(); | ||
42 | |||
43 | std::string result = "*notices ur " + n.base_form() + "* OwO whats this..?"; | ||
44 | result.resize(140); | ||
45 | |||
46 | try | ||
47 | { | ||
48 | client.updateStatus(result); | ||
49 | } catch (const twitter::twitter_error& e) | ||
50 | { | ||
51 | std::cout << "Twitter error: " << e.what() << std::endl; | ||
52 | } | ||
53 | |||
54 | std::cout << result << std::endl; | ||
55 | |||
56 | std::this_thread::sleep_for(std::chrono::hours(1)); | ||
57 | } | ||
58 | } | ||