mirror of
https://github.com/thewesker/ebooks_example.git
synced 2025-12-20 04:11:13 -05:00
Merge pull request #6 from negatendo/feature/not-a-clock
Feature/not a clock
This commit is contained in:
17
bots.rb
17
bots.rb
@@ -35,6 +35,7 @@ class BoodooBot
|
|||||||
@access_token = SETTINGS['ACCESS_TOKEN']
|
@access_token = SETTINGS['ACCESS_TOKEN']
|
||||||
@access_token_secret =SETTINGS['ACCESS_TOKEN_SECRET']
|
@access_token_secret =SETTINGS['ACCESS_TOKEN_SECRET']
|
||||||
@tweet_interval = SETTINGS['TWEET_INTERVAL']
|
@tweet_interval = SETTINGS['TWEET_INTERVAL']
|
||||||
|
@tweet_on_hour = to_boolean(SETTINGS['TWEET_ON_HOUR'])
|
||||||
@update_follows_interval = SETTINGS['UPDATE_FOLLOWS_INTERVAL']
|
@update_follows_interval = SETTINGS['UPDATE_FOLLOWS_INTERVAL']
|
||||||
@refresh_model_interval = SETTINGS['REFRESH_MODEL_INTERVAL']
|
@refresh_model_interval = SETTINGS['REFRESH_MODEL_INTERVAL']
|
||||||
|
|
||||||
@@ -94,7 +95,16 @@ class BoodooBot
|
|||||||
|
|
||||||
scheduler.interval @tweet_interval do
|
scheduler.interval @tweet_interval do
|
||||||
if rand < @tweet_chance
|
if rand < @tweet_chance
|
||||||
tweet(model.make_statement)
|
if @tweet_on_hour
|
||||||
|
tweet(model.make_statement)
|
||||||
|
else
|
||||||
|
# schedule tweet to happen at a random minute this hour
|
||||||
|
this_many_min = rand(1..59).to_s + 'm'
|
||||||
|
log "Scheduling tweet in #{this_many_min} min!"
|
||||||
|
scheduler.in.this_many_min do
|
||||||
|
tweet(model.make_statement)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -224,6 +234,11 @@ class BoodooBot
|
|||||||
text = obscure_curses(text)
|
text = obscure_curses(text)
|
||||||
super(ev, text, opts)
|
super(ev, text, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Helps us convert usage of "true" and "false" strings in .env files to booleans
|
||||||
|
def to_boolean(str)
|
||||||
|
str == 'true'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def load_model!
|
def load_model!
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ ACCESS_TOKEN=
|
|||||||
ACCESS_TOKEN_SECRET=
|
ACCESS_TOKEN_SECRET=
|
||||||
TWEET_INTERVAL=2h
|
TWEET_INTERVAL=2h
|
||||||
TWEET_CHANCE=0.8
|
TWEET_CHANCE=0.8
|
||||||
|
TWEET_ON_HOUR=true
|
||||||
BLACKLIST=tinysubversions, dril
|
BLACKLIST=tinysubversions, dril
|
||||||
BANNED_TERMS=voldemort, evgeny morozov, heroku
|
BANNED_TERMS=voldemort, evgeny morozov, heroku
|
||||||
SPECIAL_TERMS=
|
SPECIAL_TERMS=
|
||||||
|
|||||||
Reference in New Issue
Block a user