summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/search.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb
index 595dab3c..5745a24b 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -73,10 +73,11 @@ class SearchPlugin < Plugin
url = GOOGLE_WAP_SEARCH + site + searchfor
hits = params[:hits] || @bot.config['google.hits']
+ hits = 1 if params[:lucky]
first_pars = params[:firstpar] || @bot.config['google.first_par']
- single = (hits == 1 and first_pars == 1)
+ single = params[:lucky] || (hits == 1 and first_pars == 1)
begin
wml = @bot.httputil.get(url)
@@ -98,11 +99,15 @@ class SearchPlugin < Plugin
t = Utils.decode_html_entities res[2].gsub(filter, '').strip
u = URI.unescape(res[0] || res[1])
urls.push(u)
- single ? u : "#{n}. #{Bold}#{t}#{Bold}: #{u}"
+ "%{n}%{b}%{t}%{b}%{sep}%{u}" % {
+ :n => (single ? "" : "#{n}. "),
+ :sep => (single ? " -- " : ": "),
+ :b => Bold, :t => t, :u => u
+ }
}.join(" | ")
if params[:lucky]
- m.reply urls.first
+ m.reply results.first
return
end