]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/search.rb
twitter plugin: fix help
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / search.rb
index 8453b4bae9e6db8b5a14ae2595e50e0419048a54..46aa46fe538492f8c1365fd5b62685c0ce970243 100644 (file)
@@ -22,16 +22,16 @@ GOOGLE_CALC_RESULT = %r{<p><table><tr><td><img src=/images/calc_img\.gif(?: alt=
 GOOGLE_DEF_RESULT = %r{<p> (Web definitions for .*?)<br/>(.*?)<br/>(.*?)\s-\s+<a href}
 
 class SearchPlugin < Plugin
-  BotConfig.register BotConfigIntegerValue.new('google.hits',
+  Config.register Config::IntegerValue.new('google.hits',
     :default => 3,
     :desc => "Number of hits to return from Google searches")
-  BotConfig.register BotConfigIntegerValue.new('google.first_par',
+  Config.register Config::IntegerValue.new('google.first_par',
     :default => 0,
     :desc => "When set to n > 0, the bot will return the first paragraph from the first n search hits")
-  BotConfig.register BotConfigIntegerValue.new('wikipedia.hits',
+  Config.register Config::IntegerValue.new('wikipedia.hits',
     :default => 3,
     :desc => "Number of hits to return from Wikipedia searches")
-  BotConfig.register BotConfigIntegerValue.new('wikipedia.first_par',
+  Config.register Config::IntegerValue.new('wikipedia.first_par',
     :default => 1,
     :desc => "When set to n > 0, the bot will return the first paragraph from the first n wikipedia search hits")
 
@@ -85,6 +85,7 @@ class SearchPlugin < Plugin
       m.reply "no results found for #{what}"
       return
     end
+    single ||= (results.length==1)
     urls = Array.new
     results = results[0...hits].map { |res|
       n = res[0]