Last active
March 23, 2016 15:06
-
-
Save sasamijp/6257812 to your computer and use it in GitHub Desktop.
@sa2miのソースです
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' | |
require 'prime' | |
require 'date' | |
require './key.rb' | |
Twitter.configure do |config| | |
config.consumer_key = Const::CONSUMER_KEY | |
config.consumer_secret = Const::CONSUMER_SECRET | |
config.oauth_token = Const::ACCESS_TOKEN | |
config.oauth_token_secret = Const::ACCESS_TOKEN_SECRET | |
end | |
TweetStream.configure do |config| | |
config.consumer_key = Const::CONSUMER_KEY | |
config.consumer_secret = Const::CONSUMER_SECRET | |
config.oauth_token = Const::ACCESS_TOKEN | |
config.oauth_token_secret = Const::ACCESS_TOKEN_SECRET | |
config.auth_method = :oauth | |
end | |
client = TweetStream::Client.new | |
analcount= 0 | |
client.userstream do |status| | |
text = status.text.sub("@sa2mi ","") | |
replyjudge = status.text.include?("@sa2mi") | |
rtjudge = status.text.include?("RT") | |
if status.text.include?("anal") == true then | |
flag = "anal" | |
elsif status.text.include?("まぐろ") == true then | |
flag = "sushi" | |
elsif status.text.include?("komekami") == true then | |
flag = "komekami" | |
elsif status.text.include?("tokusub") == true then | |
flag = "tokusub" | |
elsif status.text.include?("turasa") == true then | |
flag = "turasa" | |
elsif text.to_i/2 != 0 then | |
input = text.to_i | |
flag = "integer" | |
end | |
if replyjudge == true && rtjudge == false && status.user.screen_name != "sa2mi" then | |
case flag | |
when "anal" then | |
puts"analdev from #{status.user.screen_name}" | |
analcount = analcount + 1 | |
analtext = "@#{status.user.screen_name} 現在アナルは#{analcount}cmです" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update analtext,option | |
when "sushi" then | |
puts"sushi from #{status.user.screen_name}" | |
sushitext= "@#{status.user.screen_name} 三🍣" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update sushitext,option | |
when "komekami" then | |
puts "komekami from #{status.user.screen_name}" | |
komekamitext = status.text.sub("@sa2mi komekami ","") | |
komekamioutput = "@#{status.user.screen_name} | |
(#{komekamitext}^_^#{komekamitext})こめかみ#{komekamitext}マンだよ~~僕はこめかみに#{komekamitext}がある奇形児なんだ。そんなに人のこと笑って楽しい?こめかみに#{komekamitext}がある奇形児だからって馬鹿にしないで。" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update komekamioutput,option | |
when "tokusub" then | |
puts "tokusub from #{status.user.screen_name}" | |
d = Date.today | |
d = d.wday | |
case d | |
when 0 then | |
day = "日曜" | |
tokusubjudge = "ツナ" | |
when 1 then | |
day = "月曜" | |
tokusubjudge = "イベリコ豚の厚切りベーコン" | |
when 2 then | |
day = "火曜" | |
tokusubjudge = "炭火てり焼きチキン" | |
when 3 then | |
day = "水曜" | |
tokusubjudge = "BLT" | |
when 4 then | |
day = "木曜" | |
tokusubjudge = "ターキーブレスト" | |
when 5 then | |
day = "金曜" | |
tokusubjudge = "ローストチキン" | |
when 6 then | |
day = "土曜" | |
tokusubjudge = "たまご" | |
end | |
tokusubjudgetext = "@#{status.user.screen_name} | |
/ ) | |
(\ / ( /フ | |
_ \ / ヽ/ _ノ | |
_ Y◜◔。◔◝ _ノ #{day}ハ#{tokusubjudge}ーwwww | |
_| ″ | |
ソ / | |
/_、__/ | |
// ∪ ∪" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update tokusubjudgetext,option | |
when "turasa" then | |
turacount = 0 | |
options = {"count" => 30} | |
turasatext = status.text.sub("@sa2mi turasa ","") | |
Twitter.user_timeline(turasatext, options).each do |res| | |
if res.text.include?("つら") then | |
turacount += 1 | |
end | |
end | |
turasatext = status.text.sub("@sa2mi turasa ","") | |
Twitter.update "@#{status.user.screen_name} #{turasatext}氏のつらさは#{turacount}です" | |
when "integer" then | |
puts"integer from #{status.user.screen_name}" | |
if input.prime? then | |
judge = "" | |
else | |
judge = "じゃない" | |
end | |
x = rand(3) | |
case x | |
when 0 then | |
intjudgetext = "@#{status.user.screen_name} | |
/ ) | |
/ ( | |
/ ヽ | |
◜◔。◔◝ | |
| | #{input}は素数#{judge}〜!! | |
| ⊃ ⊃ | |
└-⊃~⊃" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update intjudgetext,option | |
when 1 then | |
intjudgetext ="@#{status.user.screen_name} | |
/ ) | |
(\ / ( /フ | |
_ \ / ヽ/ _ノ | |
_ Y◜◔。◔◝ _ノ #{input}ハ素数#{judge}ーwwww | |
_| ″ | |
ソ / | |
/_、__/ | |
// ∪ ∪" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update intjudgetext,option | |
when 2 then | |
intjudgetext = "@#{status.user.screen_name} | |
#{input} | |
┗┏━┓━━━┏━┓┛ | |
三 ┃○┃ ┃○┃ | |
┗━┛ ┗━┛ オ フ ロ ー ド 素 数#{judge}" | |
option = {"in_reply_to_status_id"=>status.id.to_s} | |
Twitter.update intjudgetext,option | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment