Skip to content

Instantly share code, notes, and snippets.

@ikr7
Created December 11, 2013 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikr7/7911421 to your computer and use it in GitHub Desktop.
Save ikr7/7911421 to your computer and use it in GitHub Desktop.
Rubyでアニメアイコンするやつ 25行目を適当にいじって同じディレクトリにiconsってディレクトリ作って好きな画像を入れろ
# -*- 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