mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-03 13:00:41 +01:00
Made names more generic.
This commit is contained in:
parent
2b212bb37f
commit
5bae246ad5
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#re!/usr/bin/env python
|
||||||
|
|
||||||
###
|
###
|
||||||
# Copyright (c) 2002, Jeremiah Fincher
|
# Copyright (c) 2002, Jeremiah Fincher
|
||||||
@ -65,7 +65,7 @@ def configure(onStart, afterConnect, advanced):
|
|||||||
break
|
break
|
||||||
if key:
|
if key:
|
||||||
onStart.append('load Google')
|
onStart.append('load Google')
|
||||||
onStart.append('googlelicensekey %s' % key)
|
onStart.append('google licensekey %s' % key)
|
||||||
if 'load Alias' not in onStart:
|
if 'load Alias' not in onStart:
|
||||||
print 'Google depends on the Alias module for some commands.'
|
print 'Google depends on the Alias module for some commands.'
|
||||||
if yn('Would you like to load the Alias module now?') == 'y':
|
if yn('Would you like to load the Alias module now?') == 'y':
|
||||||
@ -139,7 +139,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
else:
|
else:
|
||||||
return '%s %s' % (time, '; '.join(results))
|
return '%s %s' % (time, '; '.join(results))
|
||||||
|
|
||||||
def googlelicensekey(self, irc, msg, args):
|
def licensekey(self, irc, msg, args):
|
||||||
"""<key>
|
"""<key>
|
||||||
|
|
||||||
Sets the Google license key for using Google's Web Services API. This
|
Sets the Google license key for using Google's Web Services API. This
|
||||||
@ -148,9 +148,9 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
key = privmsgs.getArgs(args)
|
key = privmsgs.getArgs(args)
|
||||||
google.setLicense(key)
|
google.setLicense(key)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
googlelicensekey = privmsgs.checkCapability(googlelicensekey, 'admin')
|
licensekey = privmsgs.checkCapability(licensekey, 'admin')
|
||||||
|
|
||||||
def disablegooglesnarfer(self, irc, msg, args):
|
def disablesnarfer(self, irc, msg, args):
|
||||||
"""takes no argument
|
"""takes no argument
|
||||||
|
|
||||||
Disables the snarfer that responds to all messages that begin with
|
Disables the snarfer that responds to all messages that begin with
|
||||||
@ -158,7 +158,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
"""
|
"""
|
||||||
self.snarfer = False
|
self.snarfer = False
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
disablegooglesnarfer=privmsgs.checkCapability(disablegooglesnarfer,'admin')
|
disablesnarfer=privmsgs.checkCapability(disablesnarfer, '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}]
|
||||||
@ -217,7 +217,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
categories and ' Categories include %s.' % categories)
|
categories and ' Categories include %s.' % categories)
|
||||||
irc.reply(msg, s)
|
irc.reply(msg, s)
|
||||||
|
|
||||||
def googlefight(self, irc, msg, args):
|
def fight(self, irc, msg, args):
|
||||||
"""<search string> <search string> [<search string> ...]
|
"""<search string> <search string> [<search string> ...]
|
||||||
|
|
||||||
Returns the results of each search, in order, from greatest number
|
Returns the results of each search, in order, from greatest number
|
||||||
@ -233,17 +233,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
s = ', '.join(['%r: %s' % (s, i) for (i, s) in results])
|
s = ', '.join(['%r: %s' % (s, i) for (i, s) in results])
|
||||||
irc.reply(msg, s)
|
irc.reply(msg, s)
|
||||||
|
|
||||||
def googlesite(self, irc, msg, args):
|
def spell(self, irc, msg, args):
|
||||||
"""<site> <search string>
|
|
||||||
|
|
||||||
Searches Google on a specific site.
|
|
||||||
"""
|
|
||||||
(site, s) = privmsgs.getArgs(args, needed=2)
|
|
||||||
searchString = 'site:%s %s' % (site, s)
|
|
||||||
data = search(searchString, language='lang_en', safeSearch=1)
|
|
||||||
irc.reply(msg, self.formatData(data))
|
|
||||||
|
|
||||||
def googlespell(self, irc, msg, args):
|
|
||||||
"""<word>
|
"""<word>
|
||||||
|
|
||||||
Returns Google's spelling recommendation for <word>.
|
Returns Google's spelling recommendation for <word>.
|
||||||
@ -255,7 +245,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
else:
|
else:
|
||||||
irc.reply(msg, 'No spelling suggestion made.')
|
irc.reply(msg, 'No spelling suggestion made.')
|
||||||
|
|
||||||
def googleinfo(self, irc, msg, args):
|
def info(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
|
|
||||||
Returns interesting information about this Google module. Mostly
|
Returns interesting information about this Google module. Mostly
|
||||||
@ -286,6 +276,8 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
_ggGroup = re.compile(r'Newsgroups: <a[^>]+>([^<]+)</a>')
|
_ggGroup = re.compile(r'Newsgroups: <a[^>]+>([^<]+)</a>')
|
||||||
def googleGroups(self, irc, msg, match):
|
def googleGroups(self, irc, msg, match):
|
||||||
r"http://groups.google.com/[^\s]+"
|
r"http://groups.google.com/[^\s]+"
|
||||||
|
if not self.snarfer:
|
||||||
|
return
|
||||||
request = urllib2.Request(match.group(0), headers=\
|
request = urllib2.Request(match.group(0), headers=\
|
||||||
{'User-agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)'})
|
{'User-agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)'})
|
||||||
fd = urllib2.urlopen(request)
|
fd = urllib2.urlopen(request)
|
||||||
@ -312,7 +304,6 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
'That doesn\'t appear to be a proper Google Groups page.'))
|
'That doesn\'t appear to be a proper Google Groups page.'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Class = Google
|
Class = Google
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user