summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-11-05 03:39:00 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-11-05 03:39:00 -0400
commit51c0f61bde2799d8c1c903d95578b9d05778a22f (patch)
treeaf20170b9046f32e010518781ea0648a0d3287b4
downloadfruity-51c0f61bde2799d8c1c903d95578b9d05778a22f.tar.gz
fruity-51c0f61bde2799d8c1c903d95578b9d05778a22f.tar.bz2
fruity-51c0f61bde2799d8c1c903d95578b9d05778a22f.zip
Initial commit
-rw-r--r--.gitmodules9
-rw-r--r--CMakeLists.txt14
-rw-r--r--owo.cpp51
m---------vendor/libtwittercpp0
m---------vendor/verbly0
m---------vendor/yaml-cpp0
6 files changed, 74 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..79dde9f --- /dev/null +++ b/.gitmodules
@@ -0,0 +1,9 @@
1[submodule "vendor/verbly"]
2 path = vendor/verbly
3 url = https://github.com/hatkirby/verbly
4[submodule "vendor/libtwittercpp"]
5 path = vendor/libtwittercpp
6 url = https://github.com/hatkirby/libtwittercpp
7[submodule "vendor/yaml-cpp"]
8 path = vendor/yaml-cpp
9 url = https://github.com/jbeder/yaml-cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3946a86 --- /dev/null +++ b/CMakeLists.txt
@@ -0,0 +1,14 @@
1cmake_minimum_required (VERSION 3.1)
2project (owo)
3
4set(CMAKE_BUILD_TYPE Debug)
5
6add_subdirectory(vendor/verbly)
7add_subdirectory(vendor/libtwittercpp)
8add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL)
9
10include_directories(vendor/verbly/lib vendor/libtwittercpp/src vendor/yaml-cpp/include)
11add_executable(owo owo.cpp)
12set_property(TARGET owo PROPERTY CXX_STANDARD 11)
13set_property(TARGET owo PROPERTY CXX_STANDARD_REQUIRED ON)
14target_link_libraries(owo verbly twitter++ yaml-cpp)
diff --git a/owo.cpp b/owo.cpp new file mode 100644 index 0000000..d6b3043 --- /dev/null +++ b/owo.cpp
@@ -0,0 +1,51 @@
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
9int 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
21 verbly::data database {"data.sqlite3"};
22
23 verbly::noun bp = database.nouns().with_wnid(105220461).run().front(); // body part
24 verbly::noun pp = database.nouns().with_wnid(104723816).run().front(); // quality
25 verbly::noun cp = database.nouns().with_wnid(103051540).run().front(); // clothing
26 verbly::filter<verbly::noun> filt {bp, pp, cp};
27 filt.set_orlogic(true);
28
29 for (;;)
30 {
31 std::cout << "Generating tweet" << std::endl;
32
33 auto ns = database.nouns().full_hyponym_of(filt).is_not_proper().random().limit(1).run();
34 verbly::noun n = ns.front();
35
36 std::string result = "*notices ur " + n.base_form() + "* OwO whats this..?";
37 result.resize(140);
38
39 try
40 {
41 client.updateStatus(result);
42 } catch (const twitter::twitter_error& e)
43 {
44 std::cout << "Twitter error: " << e.what() << std::endl;
45 }
46
47 std::cout << result << std::endl;
48
49 std::this_thread::sleep_for(std::chrono::hours(1));
50 }
51}
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp new file mode 160000
Subproject febadca7d4e0460aa78f95b53b5e36e51fd2f97
diff --git a/vendor/verbly b/vendor/verbly new file mode 160000
Subproject 6c2aca03c89b37e136ab4c7ea58b485dadc85bc
diff --git a/vendor/yaml-cpp b/vendor/yaml-cpp new file mode 160000
Subproject b5b03bb9ad6325f844314e397fb3f1b1c58eeef