Last active
August 29, 2015 14:24
-
-
Save neotaso/47a8c900b6789c96a994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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