mirror of
https://github.com/thewesker/ebooks_example.git
synced 2025-12-20 04:11:13 -05:00
convert env file string to proper boolean
This commit is contained in:
9
bots.rb
9
bots.rb
@@ -35,7 +35,7 @@ class BoodooBot
|
||||
@access_token = SETTINGS['ACCESS_TOKEN']
|
||||
@access_token_secret =SETTINGS['ACCESS_TOKEN_SECRET']
|
||||
@tweet_interval = SETTINGS['TWEET_INTERVAL']
|
||||
@tweet_on_hour = SETTINGS['TWEET_ON_HOUR']
|
||||
@tweet_on_hour = to_boolean(SETTINGS['TWEET_ON_HOUR'])
|
||||
|
||||
@update_follows_interval = SETTINGS['UPDATE_FOLLOWS_INTERVAL']
|
||||
@refresh_model_interval = SETTINGS['REFRESH_MODEL_INTERVAL']
|
||||
@@ -106,6 +106,7 @@ class BoodooBot
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scheduler.interval @update_follows_interval do
|
||||
follow_parity
|
||||
@@ -234,6 +235,11 @@ class BoodooBot
|
||||
super(ev, text, opts)
|
||||
end
|
||||
|
||||
# Helps us convert usage of "true" and "false" strings in .env files to booleans
|
||||
def to_boolean(str)
|
||||
str == 'true'
|
||||
end
|
||||
|
||||
private
|
||||
def load_model!
|
||||
return if @model
|
||||
@@ -243,6 +249,7 @@ class BoodooBot
|
||||
log "Loading model #{model_path}"
|
||||
@model = Ebooks::Model.load(model_path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
BoodooBot.new(SETTINGS['BOT_NAME']) do |bot|
|
||||
|
||||
Reference in New Issue
Block a user