Created
March 29, 2011 15:21
-
-
Save mbulat/892544 to your computer and use it in GitHub Desktop.
Earthquake plugin to open a link in a tweet
This file contains 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
# Pass in a tweet id to open a link in the text | |
# | |
# :open $xx | |
Earthquake.init do | |
command %r|^:open\s+([^\/\s]+)$|, :as => :open do |m| | |
twitter.status(m[1]).tap do |s| | |
if s["text"] | |
link_match = s["text"].match(/(https?:\/\/\S*)/) | |
if link_match | |
Launchy.open(link_match[0]) | |
else | |
puts "no link found" | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment