Module: Chatterbot::HomeTimeline

Included in:
Bot
Defined in:
lib/chatterbot/home_timeline.rb

Overview

methods for checking the bots timeline

Instance Method Summary collapse

Instance Method Details

#home_timeline(*args, &block) ⇒ Object

handle the bots timeline



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/chatterbot/home_timeline.rb', line 8

def home_timeline(*args, &block)
  return unless 
  debug "check for home_timeline tweets since #{since_id_home_timeline}"

  opts = {
    :since_id => since_id_home_timeline,
    :count => 200
  }
  results = client.home_timeline(opts)

  @current_tweet = nil
  results.each { |s|
    update_since_id_home_timeline(s)
    if block_given? && valid_tweet?(s)
      @current_tweet = s
      yield s         
    end
  }
  @current_tweet = nil
end