Created
August 1, 2012 15:07
-
-
Save kimihito/3227646 to your computer and use it in GitHub Desktop.
@hanachin_ に仕事しろと呟くbot
This file contains hidden or 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
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
require 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = 'YOUR_COMSUMER_KEY' | |
config.consumer_secret = 'YOUR_COMSUMER_SECRET' | |
config.oauth_token = 'OAUTH_TOKEN' | |
config.oauth_token_secret = 'OAUTH_TOKEN_SERCRET' | |
end | |
#最新のつぶやきの時間から、5つ目のつぶやきの時間をとってくる。 | |
a = Twitter.user_timeline("hanachin_").first.created_at | |
b = Twitter.user_timeline("hanachin_")[4].created_at | |
#その差分が30分以内だったら仕事しろとつぶやく | |
time = a - b | |
if time < 60 * 30 | |
Twitter.update('@hanachin_ 仕事しましょう') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment