X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgrouphug.rb;h=15735b9f1a710065e7884717e7edfe753f273eaf;hb=69db4133c5ccfa41c35b43c67fce1d5ff640bfd5;hp=87a7e32c1895e24c7ac8e173a16619cda2d7a99c;hpb=d29df50ddaf32536b105decefb135a0b86ee937f;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/grouphug.rb b/data/rbot/plugins/grouphug.rb index 87a7e32c..15735b9f 100644 --- a/data/rbot/plugins/grouphug.rb +++ b/data/rbot/plugins/grouphug.rb @@ -1,9 +1,11 @@ -# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/) -# (c) 2005 Mark Kretschmann -# Licensed under GPL V2. - -require "net/http" - +#-- vim:sw=2:et +#++ +# +# :title: Grouphug Plugin for rbot +# +# Author:: Mark Kretschmann +# Copyright:: (C) 2005 Mark Kretschmann +# License:: GPL v2 class GrouphugPlugin < Plugin def help( plugin, topic="" ) @@ -11,10 +13,15 @@ class GrouphugPlugin < Plugin end def confess(m, params) + opts = { :cache => false } path = "random" - path = "confessions/#{params[:num]}" if params[:num] + if params[:num] + path = "confessions/#{params[:num]}" + opts.delete(:cache) + end + begin - data = bot.httputil.get_cached(URI.parse("http://grouphug.us/#{path}")) + data = @bot.httputil.get("http://grouphug.us/#{path}", opts) reg = Regexp.new( '()(.*?)(

)', Regexp::MULTILINE ) confession = reg.match( data )[4].ircify_html