- def privmsg( m )
- path = "/random"
- path = "/confessions/#{m.params()}" if m.params()
- begin
- data = bot.httputil.get(URI.parse("http://grouphug.us/#{path}"))
-
- reg = Regexp.new( '(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', Regexp::MULTILINE )
- confession = reg.match( data )[4]
- confession.gsub!( /<.*?>/, "" ) # Remove html tags
- confession.gsub!( "\t", "" ) # Remove tab characters
-
- @bot.say(m.replyto, confession)
- rescue
- m.reply "failed to connect to grouphug.us"
- end
- end
+ begin
+ data = @bot.httputil.get("http://grouphug.us/#{path}", opts)
+
+ reg = Regexp.new('(<div class="content")(.*?)(<p>)(.*?)(</p>)',
+ Regexp::MULTILINE)
+ confession = reg.match( data )[4].ircify_html
+ confession = "no confession ##{params[:num]} found" if confession.empty? and params[:num]
+
+ m.reply confession
+ rescue
+ m.reply "failed to connect to grouphug.us"
+ end
+ end