From 51c0f61bde2799d8c1c903d95578b9d05778a22f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 5 Nov 2016 03:39:00 -0400 Subject: Initial commit --- .gitmodules | 9 +++++++++ CMakeLists.txt | 14 ++++++++++++++ owo.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/libtwittercpp | 1 + vendor/verbly | 1 + vendor/yaml-cpp | 1 + 6 files changed, 77 insertions(+) create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 owo.cpp create mode 160000 vendor/libtwittercpp create mode 160000 vendor/verbly create mode 160000 vendor/yaml-cpp diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..79dde9f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "vendor/verbly"] + path = vendor/verbly + url = https://github.com/hatkirby/verbly +[submodule "vendor/libtwittercpp"] + path = vendor/libtwittercpp + url = https://github.com/hatkirby/libtwittercpp +[submodule "vendor/yaml-cpp"] + path = vendor/yaml-cpp + 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 @@ +cmake_minimum_required (VERSION 3.1) +project (owo) + +set(CMAKE_BUILD_TYPE Debug) + +add_subdirectory(vendor/verbly) +add_subdirectory(vendor/libtwittercpp) +add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL) + +include_directories(vendor/verbly/lib vendor/libtwittercpp/src vendor/yaml-cpp/include) +add_executable(owo owo.cpp) +set_property(TARGET owo PROPERTY CXX_STANDARD 11) +set_property(TARGET owo PROPERTY CXX_STANDARD_REQUIRED ON) +target_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 @@ +#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"}; + + verbly::noun bp = database.nouns().with_wnid(105220461).run().front(); // body part + verbly::noun pp = database.nouns().with_wnid(104723816).run().front(); // quality + verbly::noun cp = database.nouns().with_wnid(103051540).run().front(); // clothing + verbly::filter filt {bp, pp, cp}; + filt.set_orlogic(true); + + for (;;) + { + std::cout << "Generating tweet" << std::endl; + + auto ns = database.nouns().full_hyponym_of(filt).is_not_proper().random().limit(1).run(); + verbly::noun n = ns.front(); + + std::string result = "*notices ur " + n.base_form() + "* OwO whats this..?"; + result.resize(140); + + try + { + client.updateStatus(result); + } catch (const twitter::twitter_error& e) + { + std::cout << "Twitter error: " << e.what() << std::endl; + } + + std::cout << result << std::endl; + + std::this_thread::sleep_for(std::chrono::hours(1)); + } +} diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp new file mode 160000 index 0000000..febadca --- /dev/null +++ b/vendor/libtwittercpp @@ -0,0 +1 @@ +Subproject commit febadca7d4e0460aa78f95b53b5e36e51fd2f97d diff --git a/vendor/verbly b/vendor/verbly new file mode 160000 index 0000000..6c2aca0 --- /dev/null +++ b/vendor/verbly @@ -0,0 +1 @@ +Subproject commit 6c2aca03c89b37e136ab4c7ea58b485dadc85bcd diff --git a/vendor/yaml-cpp b/vendor/yaml-cpp new file mode 160000 index 0000000..b5b03bb --- /dev/null +++ b/vendor/yaml-cpp @@ -0,0 +1 @@ +Subproject commit b5b03bb9ad6325f844314e397fb3f1b1c58eeeff -- cgit 1.4.1