Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Forked from emad-elsaid/twitter-thanks.rb
Last active August 29, 2015 14:02
Show Gist options
  • Save n1ckfg/22e8d9b35a376476f727 to your computer and use it in GitHub Desktop.
Save n1ckfg/22e8d9b35a376476f727 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require "rubygems"
require "twitter"
rClient = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
sClient = Twitter::Streaming::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
me = "" # prevent DMing yourself
sClient.user do |object|
if object.is_a? Twitter::Streaming::Event and object.name==:follow
user = object.source
if user.name != me
rClient.create_direct_message user, "Thanks for following me #{user.name} :)"
puts "New follower : #{object.source.name}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment