repost/plugins/commands/gentoo-bugs.rb

13 lines
399 B
Ruby
Raw Normal View History

2014-03-25 04:24:25 +00:00
require 'net/http'
require 'nokogiri'
Client.register_command("bug") { |args|
2014-03-25 04:37:16 +00:00
if args[0] =~ /^[0-9]+$/ then
doc = Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:bug][:url] + args[0])))
2014-03-25 04:45:52 +00:00
[Config[:commands][:bug][:url] + args[0], doc.title().delete!('\n'), doc.xpath('//span[@id="static_bug_status"]').inner_text.split].join(' ')
2014-03-25 04:37:16 +00:00
else
"invalid bug url"
end
2014-03-25 04:24:25 +00:00
}