Skip to content

Instantly share code, notes, and snippets.

@maimai-swap
Forked from siyo/haiku_tweet.rb
Created January 8, 2012 12:10
Show Gist options
  • Save maimai-swap/1578146 to your computer and use it in GitHub Desktop.
Save maimai-swap/1578146 to your computer and use it in GitHub Desktop.
短歌が読みたくなった時用earthquake plugin
# -*- coding: utf-8 -*-
# haiku tweet / earthquake plugin
#
# e.g. :tanka # => ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
# :tanka hoge # => hoge ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
# :tanka $xx # => @who ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
# :tanka $xx hoge # => @who hoge ここで一首、田子の浦ゆ うちいでて見れば真白にぞ 富士の高嶺に 雪は降りける
#
Earthquake.init do
command %r|^:tanka\s*(\d+)*\s*(.*)$|, :as => :haiku do |m|
cmd = m[1] ? ":reply #{m[1]}" : ":update"
input("%s %s ここで一首、 %s" % [cmd, m[2], open("http://tanka.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