mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Added disablegooglesnarfer command to disable the snarfer.
This commit is contained in:
parent
4bda1fc74a
commit
cecb130106
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user