-# Hacked up slashdot headlines plugin...
+# Hacked up digg headlines plugin...
require 'time'
require 'rexml/document'
def help(plugin, topic="")
"digg [<max>=5] => show digg headlines, [<max>=5] => return up to <max> headlines (use a negative number to show all the headlines on one line)"
end
-
+
def digg(m, params)
max = params[:limit].to_i
debug "max is #{max}"
- xml = @bot.httputil.get_cached(URI.parse("http://digg.com/rss/index.xml"))
+ xml = @bot.httputil.get('http://digg.com/rss/index.xml')
unless xml
m.reply "digg news parse failed"
return
max = 8 if max > 8
matches = Array.new
doc.elements.each("rss/channel/item") {|e|
- matches << [ e.elements["title"].text,
+ matches << [ e.elements["title"].text,
Time.parse(e.elements["pubDate"].text).strftime('%a @ %I:%M%p') ]
done += 1
break if done >= max
- }
+ }
if oneline
m.reply matches.collect{|mat| mat[0]}.join(" | ")
else