Skip to content

Instantly share code, notes, and snippets.

@Na0ki
Created September 17, 2016 06:21
Show Gist options
  • Save Na0ki/a672dd3c525fc4673cd0d85260f90a4a to your computer and use it in GitHub Desktop.
Save Na0ki/a672dd3c525fc4673cd0d85260f90a4a to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
Plugin.create(:ahiru_yakuna) do
DEFINED_TIME = Time.new.freeze
criminals = Set.new
あひる焼き = %w(burned\ duck)
filter_filter_stream_track do |watching|
p あひる焼き
[(watching.split(','.freeze) + あひる焼き).join(',')]
end
def select_reply(msg, time)
# 言語ごとに使用辞書を変える
if msg =~ /burned\ duck/
reply = "test"+rand(1000).to_s
return reply
end
end
on_appear do |ms|
ms.each do |m|
if m.to_s =~ Regexp.union(あひる焼き) and m[:created] > DEFINED_TIME and !m.retweet? and !criminals.include?(m.id)
criminals << m.id
now = Time.now.hour
# select reply dic & get sample reply
reply = select_reply(m.to_s, now)
puts reply
# send reply & fav
Service.primary.post(:message => "@#{m.user.idname} #{reply}", :replyto => m)
m.favorite(true)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment