Skip to content

Instantly share code, notes, and snippets.

@siyo
Created October 11, 2011 20:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save siyo/1279296 to your computer and use it in GitHub Desktop.
Save siyo/1279296 to your computer and use it in GitHub Desktop.
俳句が読みたくなった時用earthquake plugin
# -*- 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