diff --git a/Gemfile b/Gemfile index f601553..892218b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,3 +4,4 @@ ruby '2.1.3' gem 'twitter_ebooks', '3.0.8' gem 'dotenv' gem 'cloudinary' +gem 'time_difference' diff --git a/Gemfile.lock b/Gemfile.lock index cc4b8ad..e1e1e2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,12 @@ GEM remote: http://rubygems.org/ specs: + activesupport (4.2.0) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) addressable (2.3.7) awesome_print (1.6.1) aws_cf_signer (0.1.3) @@ -27,11 +33,13 @@ GEM http (0.6.3) http_parser.rb (~> 0.6.0) http_parser.rb (0.6.0) + i18n (0.7.0) json (1.8.2) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) method_source (0.8.2) mime-types (2.4.3) + minitest (5.5.1) multipart-post (2.0.0) naught (1.0.0) netrc (0.10.2) @@ -49,6 +57,8 @@ GEM simple_oauth (0.3.1) slop (3.6.0) thread_safe (0.3.4) + time_difference (0.3.2) + activesupport twitter (5.13.0) addressable (~> 2.3) buftok (~> 0.2.0) @@ -80,4 +90,5 @@ PLATFORMS DEPENDENCIES cloudinary dotenv + time_difference twitter_ebooks (= 3.0.8) diff --git a/app.json b/app.json index 6c6af9e..1b4131c 100644 --- a/app.json +++ b/app.json @@ -26,6 +26,10 @@ "CONSUMER_SECRET": "", "ACCESS_TOKEN": "", "ACCESS_TOKEN_SECRET": "", + "INITIAL_CORPUS_FILE": { + "required": false, + "value": "tweets.csv" + } "CLOUDINARY_URL": { "required": false, "value": "" diff --git a/boodoo.rb b/boodoo.rb index 352842a..b55c21b 100644 --- a/boodoo.rb +++ b/boodoo.rb @@ -348,11 +348,7 @@ class Ebooks::Boodoo::BoodooBot < Ebooks::Bot # Override Ebooks::Bot#blacklisted? to ensure lower<=>lower check def blacklisted?(username) - if @blacklist.map(&:downcase).include?(username.downcase) - true - else - false - end + @blacklist.map(&:downcase).include?(username.downcase) end # Follow new followers, unfollow lost followers diff --git a/bots.rb b/bots.rb index 43cfeca..373d96b 100644 --- a/bots.rb +++ b/bots.rb @@ -1,6 +1,7 @@ require 'twitter_ebooks' require_relative 'boodoo' require 'dotenv' +require 'time_difference' include Ebooks::Boodoo @@ -62,6 +63,7 @@ class BoodooBot @attempts = 0 @followers = [] @following = [] + @initial_corpus_file = SETTINGS['INITIAL_CORPUS_FILE'] @archive_path = "corpus/#{@original}.json" @model_path = "model/#{@original}.model" diff --git a/defaults.env b/defaults.env index 98b39a7..4fa7d52 100644 --- a/defaults.env +++ b/defaults.env @@ -4,6 +4,7 @@ CONSUMER_KEY= CONSUMER_SECRET= ACCESS_TOKEN= ACCESS_TOKEN_SECRET= +INITIAL_CORPUS_FILE=tweets.csv CLOUDINARY_URL= TWEET_INTERVAL=2h TWEET_CHANCE=0.8