Improvements, improvements…

This commit is contained in:
Robert Gerus 2014-03-25 05:37:16 +01:00
parent 8e7de643df
commit 725262c5c6

View file

@ -2,6 +2,11 @@ require 'net/http'
require 'nokogiri'
Client.register_command("bug") { |args|
Config[:commands][:bug][:url] + args[0] + Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:bug][:url] + args[0]))).title().delete!('\n')
if args[0] =~ /^[0-9]+$/ then
doc = Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:bug][:url] + args[0])))
Config[:commands][:bug][:url] + args[0] + " " + doc.title().delete!('\n')
else
"invalid bug url"
end
}