Created
November 24, 2013 14:47
Revisions
-
sasamijp created this gist
Nov 24, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ # -*- encoding: utf-8 -*- require 'rubygems' require 'tweetstream' require 'twitter' require './key.rb' Twitter.configure do |config| config.consumer_key = Const::CONSUMER_KEY config.consumer_secret = Const::CONSUMER_SECRET config.oauth_token = Const::ACCESS_TOKEN config.oauth_token_secret = Const::ACCESS_TOKEN_SECRET end TweetStream.configure do |config| config.consumer_key = Const::CONSUMER_KEY config.consumer_secret = Const::CONSUMER_SECRET config.oauth_token = Const::ACCESS_TOKEN config.oauth_token_secret = Const::ACCESS_TOKEN_SECRET config.auth_method = :oauth end #Twitter.update_profile(:name => "test") client = TweetStream::Client.new client.userstream do |status| if status.text.include?("(@sasamijp)") && !status.text.include?("RT") then text = status.text.sub("(@sasamijp)","") text = text.sub("@","") Twitter.update_profile(:name => "#{text}") option = {"in_reply_to_status_id"=>status.id.to_s} tweet = "@#{status.user.screen_name} #{text}に改名しました" Twitter.update tweet,option end end