mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Added support for old google (the crazy irc bot)-style google responses.
This commit is contained in:
parent
1c49500263
commit
85331d2848
@ -42,6 +42,7 @@ import operator
|
|||||||
import google
|
import google
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
|
import ircmsgs
|
||||||
import privmsgs
|
import privmsgs
|
||||||
import callbacks
|
import callbacks
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ def configure(onStart, afterConnect, advanced):
|
|||||||
print 'You\'ll need to get a key before you can use this plugin.'
|
print 'You\'ll need to get a key before you can use this plugin.'
|
||||||
print 'You can apply for a key from http://www.google.com/apis/'
|
print 'You can apply for a key from http://www.google.com/apis/'
|
||||||
|
|
||||||
class Google(callbacks.Privmsg):
|
class GooglePrivmsg(callbacks.Privmsg):
|
||||||
threaded = True
|
threaded = True
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
@ -162,6 +163,17 @@ class Google(callbacks.Privmsg):
|
|||||||
self.totalTime))
|
self.totalTime))
|
||||||
|
|
||||||
|
|
||||||
|
class GooglePrivmsgRegexp(callbacks.PrivmsgRegexp):
|
||||||
|
threaded = True
|
||||||
|
def googleSnarfer(self, irc, msg, match):
|
||||||
|
r"^google\s+(.*)$"
|
||||||
|
data = google.doGoogleSearch(match.group(1), safeSearch=1)
|
||||||
|
url = data.results[0].URL
|
||||||
|
irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg), url))
|
||||||
|
|
||||||
|
class Google(callbacks.Combine):
|
||||||
|
classes = [GooglePrivmsg, GooglePrivmsgRegexp]
|
||||||
|
|
||||||
Class = Google
|
Class = Google
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user