Don't send empty queries.

This commit is contained in:
Jeremy Fincher 2004-08-31 05:53:05 +00:00
parent e138211f9b
commit 6985fe3803

View File

@ -182,6 +182,14 @@ conf.registerGlobalValue(conf.supybot.plugins.Google, 'licenseKey',
Services API. This is necessary before you can do any searching with this Services API. This is necessary before you can do any searching with this
module.""", private=True)) module.""", private=True))
conf.registerGroup(conf.supybot.plugins.Google, 'state')
conf.registerGlobalValue(conf.supybot.plugins.Google.state, 'searches',
registry.Float(0.0, """Used to keep the total number of searches Google has
done for this bot. You shouldn't modify this."""))
conf.registerGlobalValue(conf.supybot.plugins.Google.state, 'time',
registry.Float(0.0, """Used to keep the total amount of time Google has
spent searching for this bot. You shouldn't modify this."""))
class Google(callbacks.PrivmsgCommandAndRegexp): class Google(callbacks.PrivmsgCommandAndRegexp):
threaded = True threaded = True
regexps = sets.Set(['googleSnarfer', 'googleGroups']) regexps = sets.Set(['googleSnarfer', 'googleGroups'])
@ -250,6 +258,8 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
kwargs['filter'] = False kwargs['filter'] = False
else: else:
kwargs[option[2:]] = argument kwargs[option[2:]] = argument
if not rest:
raise callbacks.ArgumentError
try: try:
data = search(self.log, rest, **kwargs) data = search(self.log, rest, **kwargs)
except google.NoLicenseKey, e: except google.NoLicenseKey, e: