summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules9
-rw-r--r--CMakeLists.txt12
-rw-r--r--composite.cpp39
m---------vendor/libtwittercpp0
m---------vendor/verbly0
m---------vendor/yaml-cpp0
6 files changed, 60 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3ac2123 --- /dev/null +++ b/.gitmodules
@@ -0,0 +1,9 @@
1[submodule "vendor/libtwittercpp"]
2 path = vendor/libtwittercpp
3 url = https://github.com/hatkirby/libtwittercpp
4[submodule "vendor/verbly"]
5 path = vendor/verbly
6 url = https://github.com/hatkirby/verbly
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..a90ea6e --- /dev/null +++ b/CMakeLists.txt
@@ -0,0 +1,12 @@
1cmake_minimum_required (VERSION 3.1)
2project (composite)
3
4add_subdirectory(vendor/libtwittercpp)
5add_subdirectory(vendor/verbly)
6add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL)
7
8include_directories(vendor/libtwittercpp/src vendor/verbly/lib vendor/yaml-cpp/include)
9add_executable(composite composite.cpp)
10set_property(TARGET composite PROPERTY CXX_STANDARD 11)
11set_property(TARGET composite PROPERTY CXX_STANDARD_REQUIRED ON)
12target_link_libraries(composite verbly twitter++ yaml-cpp)
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
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 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
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp new file mode 160000
Subproject 501880160ac69f90143bc38add541731a9242ab
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 728e26e42645d4d70ca65522990f915f47b47a5