]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/grouphug.rb
keywords plugin: keyword wipe command to remove unforgettable keywords
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / grouphug.rb
index 32a6e55ecd2b39293bd7f6824d0125d8f3b73049..bf246b4c7f7fa23b3911dbf4169b4c01d59071a5 100644 (file)
@@ -20,19 +20,17 @@ class GrouphugPlugin < Plugin
       opts.delete(:cache)
     end
 
-    Thread.start do
-      begin
-        data = @bot.httputil.get("http://grouphug.us/#{path}", opts)
-
-        reg = Regexp.new('(<td class="conf-text")(.*?)(<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
+    begin
+      data = @bot.httputil.get("http://grouphug.us/#{path}", opts)
+
+      reg = Regexp.new('(<td class="conf-text")(.*?)(<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
 end
@@ -40,6 +38,8 @@ end
 
 plugin = GrouphugPlugin.new
 
-plugin.map "grouphug [:num]", :action => :confess, :requirements => { :num => /\d+/ }
-plugin.map "confess [:num]", :action => :confess, :requirements => { :num => /\d+/ }
+plugin.map "grouphug [:num]",
+  :thread => true, :action => :confess, :requirements => { :num => /\d+/ }
+plugin.map "confess [:num]",
+  :thread => true, :action => :confess, :requirements => { :num => /\d+/ }