mirror of
https://github.com/thewesker/ebooks_example.git
synced 2025-12-22 05:11:08 -05:00
add time_difference gem
first use of INITIAL_CORPUS_FILE env var more concise bot#blacklisted?
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -4,3 +4,4 @@ ruby '2.1.3'
|
|||||||
gem 'twitter_ebooks', '3.0.8'
|
gem 'twitter_ebooks', '3.0.8'
|
||||||
gem 'dotenv'
|
gem 'dotenv'
|
||||||
gem 'cloudinary'
|
gem 'cloudinary'
|
||||||
|
gem 'time_difference'
|
||||||
|
|||||||
11
Gemfile.lock
11
Gemfile.lock
@@ -1,6 +1,12 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
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)
|
addressable (2.3.7)
|
||||||
awesome_print (1.6.1)
|
awesome_print (1.6.1)
|
||||||
aws_cf_signer (0.1.3)
|
aws_cf_signer (0.1.3)
|
||||||
@@ -27,11 +33,13 @@ GEM
|
|||||||
http (0.6.3)
|
http (0.6.3)
|
||||||
http_parser.rb (~> 0.6.0)
|
http_parser.rb (~> 0.6.0)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
|
i18n (0.7.0)
|
||||||
json (1.8.2)
|
json (1.8.2)
|
||||||
memoizable (0.4.2)
|
memoizable (0.4.2)
|
||||||
thread_safe (~> 0.3, >= 0.3.1)
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (2.4.3)
|
mime-types (2.4.3)
|
||||||
|
minitest (5.5.1)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
naught (1.0.0)
|
naught (1.0.0)
|
||||||
netrc (0.10.2)
|
netrc (0.10.2)
|
||||||
@@ -49,6 +57,8 @@ GEM
|
|||||||
simple_oauth (0.3.1)
|
simple_oauth (0.3.1)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
|
time_difference (0.3.2)
|
||||||
|
activesupport
|
||||||
twitter (5.13.0)
|
twitter (5.13.0)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.3)
|
||||||
buftok (~> 0.2.0)
|
buftok (~> 0.2.0)
|
||||||
@@ -80,4 +90,5 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
cloudinary
|
cloudinary
|
||||||
dotenv
|
dotenv
|
||||||
|
time_difference
|
||||||
twitter_ebooks (= 3.0.8)
|
twitter_ebooks (= 3.0.8)
|
||||||
|
|||||||
4
app.json
4
app.json
@@ -26,6 +26,10 @@
|
|||||||
"CONSUMER_SECRET": "",
|
"CONSUMER_SECRET": "",
|
||||||
"ACCESS_TOKEN": "",
|
"ACCESS_TOKEN": "",
|
||||||
"ACCESS_TOKEN_SECRET": "",
|
"ACCESS_TOKEN_SECRET": "",
|
||||||
|
"INITIAL_CORPUS_FILE": {
|
||||||
|
"required": false,
|
||||||
|
"value": "tweets.csv"
|
||||||
|
}
|
||||||
"CLOUDINARY_URL": {
|
"CLOUDINARY_URL": {
|
||||||
"required": false,
|
"required": false,
|
||||||
"value": ""
|
"value": ""
|
||||||
|
|||||||
@@ -348,11 +348,7 @@ class Ebooks::Boodoo::BoodooBot < Ebooks::Bot
|
|||||||
|
|
||||||
# Override Ebooks::Bot#blacklisted? to ensure lower<=>lower check
|
# Override Ebooks::Bot#blacklisted? to ensure lower<=>lower check
|
||||||
def blacklisted?(username)
|
def blacklisted?(username)
|
||||||
if @blacklist.map(&:downcase).include?(username.downcase)
|
@blacklist.map(&:downcase).include?(username.downcase)
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Follow new followers, unfollow lost followers
|
# Follow new followers, unfollow lost followers
|
||||||
|
|||||||
2
bots.rb
2
bots.rb
@@ -1,6 +1,7 @@
|
|||||||
require 'twitter_ebooks'
|
require 'twitter_ebooks'
|
||||||
require_relative 'boodoo'
|
require_relative 'boodoo'
|
||||||
require 'dotenv'
|
require 'dotenv'
|
||||||
|
require 'time_difference'
|
||||||
|
|
||||||
include Ebooks::Boodoo
|
include Ebooks::Boodoo
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ class BoodooBot
|
|||||||
@attempts = 0
|
@attempts = 0
|
||||||
@followers = []
|
@followers = []
|
||||||
@following = []
|
@following = []
|
||||||
|
@initial_corpus_file = SETTINGS['INITIAL_CORPUS_FILE']
|
||||||
@archive_path = "corpus/#{@original}.json"
|
@archive_path = "corpus/#{@original}.json"
|
||||||
@model_path = "model/#{@original}.model"
|
@model_path = "model/#{@original}.model"
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ CONSUMER_KEY=
|
|||||||
CONSUMER_SECRET=
|
CONSUMER_SECRET=
|
||||||
ACCESS_TOKEN=
|
ACCESS_TOKEN=
|
||||||
ACCESS_TOKEN_SECRET=
|
ACCESS_TOKEN_SECRET=
|
||||||
|
INITIAL_CORPUS_FILE=tweets.csv
|
||||||
CLOUDINARY_URL=
|
CLOUDINARY_URL=
|
||||||
TWEET_INTERVAL=2h
|
TWEET_INTERVAL=2h
|
||||||
TWEET_CHANCE=0.8
|
TWEET_CHANCE=0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user