Sha256: 3ddcf69574fea5236cb267bb03d3fe7a7505b6c543f4f16be31486e9cbf8041d

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

module Chatterbot

  #
  # reply method for responding to tweets
  module Reply

    # handle replies for the bot
    def replies(&block)
      return unless require_login

      debug "check for replies since #{since_id_reply}"

      opts = {}
      if since_id_reply > 0
        opts[:since_id] = since_id_reply
      elsif since_id > 0
        opts[:since_id] = since_id
      end
      opts[:count] = 200

      results = client.mentions_timeline(opts)
      @current_tweet = nil
      results.each { |s|
        update_since_id_reply(s)
        unless ! block_given? || on_blacklist?(s) || skip_me?(s)
          @current_tweet = s
          yield s         
        end
      }
      @current_tweet = nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chatterbot-0.9.1 lib/chatterbot/reply.rb
chatterbot-0.9.0 lib/chatterbot/reply.rb