Skip to content

Instantly share code, notes, and snippets.

@suna-pan
Last active December 20, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suna-pan/6139175 to your computer and use it in GitHub Desktop.
Save suna-pan/6139175 to your computer and use it in GitHub Desktop.
mikutter愛のない全自動バルスプラグインだよ。
# -*- 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