Created
December 11, 2013 14:35
-
-
Save ikr7/7911421 to your computer and use it in GitHub Desktop.
Rubyでアニメアイコンするやつ 25行目を適当にいじって同じディレクトリにiconsってディレクトリ作って好きな画像を入れろ
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
# -*- encoding: utf-8 -*- | |
require 'rubygems' | |
require 'tweetstream' | |
require 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = '' | |
config.consumer_secret = '' | |
config.oauth_token = '' | |
config.oauth_token_secret = '' | |
end | |
TweetStream.configure do |config| | |
config.consumer_key = '' | |
config.consumer_secret = '' | |
config.oauth_token = '' | |
config.oauth_token_secret = '' | |
config.auth_method = :oauth | |
end | |
list = Dir.entries('icons') | |
client = TweetStream::Client.new | |
client.userstream do |status| | |
if /^@aWtyNw__\s+anime_icon$/i =~ status.text then | |
Twitter.update_profile_image File.new('icons/' + list[rand list.length]) | |
text = '@' + status.user.screen_name + ' (っ╹◡╹c)アイコンを変更しました!' | |
opts = {'in_reply_to_status_id' => status.id.to_s} | |
Twitter.update text, opts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment