Sha256: dcfc0d39412f5503ca8859b5687a99761d77d33a99deb5d1f81fda9bb9a5b487

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 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}"

      opts = since_id > 0 ? {:since_id => since_id} : {}
      results = client.replies(opts)

      if results.is_a?(Hash) && results.has_key?("error")
        critical results["error"]
      else
        results.each { |s|
          s.symbolize_keys!
          unless ! block_given? || on_blacklist?(s) || skip_me?(s)
            update_since_id(s)
            yield s         
          end
        }
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chatterbot-0.5.1 lib/chatterbot/reply.rb
chatterbot-0.5.0 lib/chatterbot/reply.rb
chatterbot-0.4.0 lib/chatterbot/reply.rb
chatterbot-0.3.0 lib/chatterbot/reply.rb
chatterbot-0.2.9 lib/chatterbot/reply.rb