summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/search.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb
index a7ac64cb..542f7cba 100644
--- a/data/rbot/plugins/search.rb
+++ b/data/rbot/plugins/search.rb
@@ -96,6 +96,11 @@ class SearchPlugin < Plugin
single ? u : "#{n}. #{Bold}#{t}#{Bold}: #{u}"
}.join(" | ")
+ if params[:lucky]
+ m.reply urls.first
+ return
+ end
+
# If we return a single, full result, change the output to a more compact representation
if single
m.reply "Result for %s: %s -- %s" % [what, results, Utils.get_first_pars(urls, first_pars)], :overlong => :truncate
@@ -110,6 +115,11 @@ class SearchPlugin < Plugin
end
+ def lucky(m, params)
+ params.merge!(:lucky => true)
+ google(m, params)
+ end
+
def gcalc(m, params)
what = params[:words].to_s
searchfor = CGI.escape(what)
@@ -224,6 +234,7 @@ plugin = SearchPlugin.new
plugin.map "search *words", :action => 'google', :threaded => true
plugin.map "google *words", :action => 'google', :threaded => true
+plugin.map "lucky *words", :action => 'lucky', :threaded => true
plugin.map "gcount *words", :action => 'gcount', :threaded => true
plugin.map "gcalc *words", :action => 'gcalc', :threaded => true
plugin.map "gdef *words", :action => 'gdef', :threaded => true