From c9edc3747f1a11c1f7debe7feb4b407117241c64 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 23 Feb 2018 11:21:55 -0500 Subject: Prevented bot from replying to blocked accounts Mostly just to prevent it from entering a reply loop with rawr_ebooks. --- insult.cpp | 7 +++++-- vendor/libtwittercpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/insult.cpp b/insult.cpp index 6c60f72..db4f920 100644 --- a/insult.cpp +++ b/insult.cpp @@ -34,17 +34,20 @@ int main(int argc, char** argv) try { + std::set blocks = client.getBlocks(); + verbly::database database(config["verbly_datafile"].as()); patterner pgen(config["forms_file"].as(), database, rng); std::cout << "Starting streaming..." << std::endl; - twitter::stream userStream(client, [&pgen, &client] + twitter::stream userStream(client, [&pgen, &client, &blocks] (const twitter::notification& n) { if (n.getType() == twitter::notification::type::tweet) { if ((!n.getTweet().isRetweet()) - && (n.getTweet().getAuthor() != client.getUser())) + && (n.getTweet().getAuthor() != client.getUser()) + && (!blocks.count(n.getTweet().getAuthor().getID()))) { std::string original = n.getTweet().getText(); std::string canonical; diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp index df90612..3e292e3 160000 --- a/vendor/libtwittercpp +++ b/vendor/libtwittercpp @@ -1 +1 @@ -Subproject commit df906121dd862c0f704e44f28ee079158c431c41 +Subproject commit 3e292e37a1313e22f13ef4b7f342c6002ea6a947 -- cgit 1.4.1