Last active
December 20, 2015 13:29
-
-
Save suna-pan/6139175 to your computer and use it in GitHub Desktop.
mikutter愛のない全自動バルスプラグインだよ。
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
# -*- coding: utf-8 -*- | |
Plugin.create(:mikutter_nolove_bars) do | |
on_boot do | |
@buf = Array.new | |
@id = 0 | |
end | |
on_appear do |msg| | |
msg.each do |m| | |
if m[:id] > @id and /バルス/ =~ m[:message] | |
@id = m[:id] | |
now = m[:created] | |
@buf << now | |
@buf.delete_if{ |t| now - t > 5 } | |
p @buf | |
Post.primary_service.update(message: "バルス!") if @buf.size >= 5 | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment