Module: Chatterbot::Reply

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

Overview

handle checking for mentions of the bot

Instance Method Summary collapse

Instance Method Details

#replies(*args, &block) ⇒ Object

handle replies for the bot



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

def replies(*args, &block)
  return unless 

  debug "check for replies since #{since_id_reply}"

  opts = {
    :since_id => since_id_reply,
    :count => 200
  }

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