Sha256: 5e10068968caeec9fed50452abb1a59a0613e1b25fdd62827f3aad48e3629c94
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Chatterbot # # handle Twitter searches module Search # # modify a query string to exclude retweets from searches # def exclude_retweets(q) q.include?("include:retweets") ? q : q += " -include:retweets" end # internal search code def search(queries, opts = {}, &block) debug "check for tweets since #{since_id}" if queries.is_a?(String) queries = [queries] end # # search twitter # queries.each { |query| debug "search: #{query} #{default_opts.merge(opts)}" result = client.search( exclude_retweets(query), default_opts.merge(opts) ) update_since_id(result) @current_tweet = nil result.each { |s| debug s.text if 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/search.rb |
chatterbot-0.9.0 | lib/chatterbot/search.rb |