bakabot @railstokyo
Rails勉強会@Tokyoで参加して、簡単のバカボット作ってみた。
OpenSocial開発で忙しすぎて、簡単のボットを作るのが早くて楽しかったですね。
おじさんのように大きい声で大文字叫ぶボットです!
次回の勉強会のために@railstokyoをフォローしてください。
require 'rubygems'
require 'twitter'
ACCOUNT_NAME = 'XX' # using plain text login
RTPW = 'XX' # your pw here
httpauth = Twitter::HTTPAuth.new(ACCOUNT_NAME, RTPW)
client = Twitter::Base.new(httpauth)
client.friends_timeline(:count => 30 ).each do |tm|
if tm.user.name != ACCOUNT_NAME then
str = "RT @#{tm.user.screen_name} >> #{tm.text.upcase}"
client.update(str)
end
end
もっとシンプルな確認方法もあります:
curl -u user:pass http://api.twitter.com/1/statuses/friends_timeline.xml