Skip to content

Instantly share code, notes, and snippets.

@neotaso
Last active August 29, 2015 14:24
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 neotaso/47a8c900b6789c96a994 to your computer and use it in GitHub Desktop.
Save neotaso/47a8c900b6789c96a994 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'twitter'
client = 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
begin
Process.daemon
sclient.user do |object|
if object.is_a?(Twitter::Tweet)
if /\(\s*\@your_screen_name\s*\)/i =~ object.text
name = object.text.gsub(/\s*\(\s*\@your_screen_name\s*\).*/i, "")
begin
client.update_profile({name: name})
client.update("私の名前が@#{object.user.screen_name} の手によって#{name}に書き換えられた", in_reply_to_status: object)
rescue
client.update("@#{object.user.screen_name} それは許されない", in_reply_to_status: object)
end
end
end
rescue
retry
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment