Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/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