Added disablegooglesnarfer command to disable the snarfer.

This commit is contained in:
Jeremy Fincher 2003-10-02 22:36:20 +00:00
parent 4bda1fc74a
commit cecb130106

View File

@ -119,6 +119,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
callbacks.PrivmsgCommandAndRegexp.__init__(self) callbacks.PrivmsgCommandAndRegexp.__init__(self)
self.total = 0 self.total = 0
self.totalTime = 0 self.totalTime = 0
self.snarfer = True
self.last24hours = structures.queue() self.last24hours = structures.queue()
def formatData(self, data): def formatData(self, data):
@ -147,6 +148,16 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
googlelicensekey = privmsgs.checkCapability(googlelicensekey, 'admin') googlelicensekey = privmsgs.checkCapability(googlelicensekey, 'admin')
def disablegooglesnarfer(self, irc, msg, args):
"""takes no argument
Disables the snarfer that responds to all messages that begin with
'google'
"""
self.snarfer = False
irc.reply(msg, conf.replySuccess)
disablegooglesnarfer=privmsgs.checkCapability(disablegooglesnarfer,'admin')
def google(self, irc, msg, args): def google(self, irc, msg, args):
"""<search> [--{language,restrict}=<value>] [--{notsafe,similar}] """<search> [--{language,restrict}=<value>] [--{notsafe,similar}]
@ -258,6 +269,8 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
def googleSnarfer(self, irc, msg, match): def googleSnarfer(self, irc, msg, match):
r"^google\s+(.*)$" r"^google\s+(.*)$"
if not self.snarfer:
return
searchString = match.group(1) searchString = match.group(1)
data = search(searchString, safeSearch=1) data = search(searchString, safeSearch=1)
if data.results: if data.results: