Class: Twitter2Fleep::Bot
- Inherits:
-
Object
- Object
- Twitter2Fleep::Bot
- Defined in:
- lib/twitter2fleep/bot.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Bot
constructor
A new instance of Bot.
- #start ⇒ Object
Constructor Details
#initialize(config) ⇒ Bot
Returns a new instance of Bot.
6 7 8 9 10 |
# File 'lib/twitter2fleep/bot.rb', line 6 def initialize(config) @twitter_client = Twitter::Streaming::Client.new(config[:twitter]) @selected_user_ids = config[:selected_user_ids] @fleep_hook_url = config[:fleep_hook_url] end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/twitter2fleep/bot.rb', line 12 def start @twitter_client.user do |object| case object when Twitter::Tweet tweet = object = tweet.user if should_post?(tweet) = "@#{.screen_name}: #{tweet.text}" response = post_to_fleep(.screen_name, ) puts puts "----> #{response.status_code}" end when Twitter::Streaming::StallWarning warn "Falling behind!" end end end |