Created
October 11, 2011 20:23
-
-
Save siyo/1279296 to your computer and use it in GitHub Desktop.
俳句が読みたくなった時用earthquake plugin
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
# -*- coding: utf-8 -*- | |
# haiku tweet / earthquake plugin | |
# | |
# e.g. :haiku # => ここで一句、柿食えば 鐘がなるなり 法隆寺 | |
# :haiku hoge # => hoge ここで一句、柿食えば 鐘がなるなり 法隆寺 | |
# :haiku $xx # => @who ここで一句、柿食えば 鐘がなるなり 法隆寺 | |
# :haiku $xx hoge # => @who hoge ここで一句、柿食えば 鐘がなるなり 法隆寺 | |
# | |
Earthquake.init do | |
command %r|^:haiku\s*(\d+)*\s*(.*)$|, :as => :haiku do |m| | |
cmd = m[1] ? ":reply #{m[1]}" : ":update" | |
input("%s %s ここで一句、 %s" % [cmd, m[2], open("http://haiku.jgate.de/"){|f| f.read}]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment