Skip to content

Instantly share code, notes, and snippets.

@icambridge
Created September 4, 2011 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icambridge/1193043 to your computer and use it in GitHub Desktop.
Save icambridge/1193043 to your computer and use it in GitHub Desktop.
Thread test
threads = []
tracking = ['#potbot','@potbot1','#potbottest','#fml','#cool']
for trackWord in tracking
threads << Thread.new({ :object => TweetStream::Client.new("username", "password"), :word => trackWord }) { |data|
word = data[:word]
stream = data[:object]
puts "Starting to track #{word}"
stream.track(word) do |status|
puts "#{word}-[#{status.user.screen_name}] #{status.text}"
#client.statuses.update! :status=>"@#{status.user.screen_name} I'll see wat I can do about #{trackWord}!",:in_reply_to_status_id=>status.id_str
end
puts "Finishing to track #{word}"
}
end
threads.each { |aThread| aThread.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment