Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding support for displayng rstatus status updates.

Right now statuses will be displayed when linked in the channel
and they can be displayed by id. However, right now there is no
support for displaying the latest status update for a given username
since I am currently unsure how to distingish it from the status id's
themselves.
  • Loading branch information...
commit eccc3deb61a0253d75a02dcdb0245afc972adc16 1 parent f40d9d4
@LindseyB authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 lib/xombot/plugins/rstatus.rb
View
27 lib/xombot/plugins/rstatus.rb
@@ -0,0 +1,27 @@
+require 'open-uri'
+
+class Rstatus < XOmBot::Plugin
+ match /rstatus (\w+)/, :method => :rstatus_by_id
+ help "Displays the rstatus update with the given id"
+ usage "rstatus 12345678 -- displays the rstatus update with that id"
+
+
+ def setup
+ url_plugin = XOmBot.plugins["URLAnnounce"]
+ if url_plugin
+ url_plugin.match_domain("rstat.us") do |m, url|
+ rstatus_by_url m, url
+ end
+ end
+ end
+
+ def rstatus_by_id(m, id)
+ rstatus_by_url m, "https://rstat.us/updates/#{id}"
+ end
+
+
+ def rstatus_by_url(m, url)
+ doc = Nokogiri::HTML(open(url))
+ m.reply "@#{doc.css('.byline a:nth-child(2)').first.text.strip!}: #{doc.css('.content').first.text.strip!}"
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.