Created
October 18, 2011 10:53
-
-
Save siyo/1295153 to your computer and use it in GitHub Desktop.
パクリツイートを見つけてさらにパクる時用earthquake.gem 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 -*- | |
# | |
# e.g. | |
# [$ab] foo: yo! | |
# . | |
# . | |
# [$nz] who: yo! | |
# | |
# ⚡ :echo | |
# update 'yo!' [Yn] | |
# | |
Earthquake.init do | |
command :echo do | |
a = ("aa".."zz").to_a.inject([]){|s,v| | |
break s unless id = var2id("$#{v}"); | |
next s unless st = cache.read("status:#{id}"); | |
s << st if st["text"] && !(/^RT\s/ =~ st["text"]) | |
s | |
} | |
txts = a.sort_by{|e| e["id"]}.reverse.map{|st| st["text"]} | |
if txt = txts.uniq.detect{|e| txts.index(e) != txts.rindex(e)} | |
input(":update #{txt}") | |
else | |
puts "Not found echo tweet." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment