Created
March 28, 2014 16:54
-
-
Save erutaso/9837514 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
def change_icon(status) | |
#streamingから@user_name change_iconを見つけたら以下を実行する | |
if status.text.include?("@#{@name} change_icon") then | |
#画像が入ってるディレクトリからランダムに取ってくる。パスは各自変更 | |
p = Dir::entries('./icon').sample | |
#ランダムに選ばれた画像を開く(よくわからん) | |
pic = open("./icon/#{p}", "r") | |
p pic | |
#iconを変更 | |
@rest_client.update_profile_image(pic) | |
#replyと変更したよというツイート内容 | |
opt = {"in_reply_to_status_id"=>status.id.to_s} | |
tweet = "@#{status.user.screen_name} change #{p}" | |
#上記をツイート | |
@rest_client.update tweet,opt | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment