From cc193c39ea3230f903e347d3f8a32ceceb32ffa0 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 2 Jul 2004 13:53:33 +0000 Subject: [PATCH] Added lucky command. --- plugins/Google.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/Google.py b/plugins/Google.py index 082d90a08..1d0106f42 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -211,6 +211,18 @@ class Google(callbacks.PrivmsgCommandAndRegexp): else: return '%s: %s' % (time, '; '.join(results)) + def lucky(self, irc, msg, args): + """ + + Does a google search, but only returns the first result. + """ + data = search(self.log, args) + if data.results: + url = data.results[0].URL + irc.reply(url) + else: + irc.reply('Google found nothing.') + def google(self, irc, msg, args): """ [--{language,restrict}=] [--{notsafe,similar}]