Changed the default of the snarfer, added a question to configure.

This commit is contained in:
Jeremy Fincher 2003-11-19 23:34:53 +00:00
parent 2a5cc04749
commit fb4a4ffca7
5 changed files with 41 additions and 18 deletions

View File

@ -72,13 +72,12 @@ class BugzillaError(Exception):
def configure(onStart, afterConnect, advanced):
from questions import expect, anything, yn
onStart.append('load Bugzilla')
if advanced:
print 'The Bugzilla plugin has the functionality to watch for URLs'
print 'that match a specific pattern (we call this a snarfer). When'
print 'supybot sees such a URL, he will parse the web page for'
print 'information and reply with the results.\n'
if yn('Do you want the Bugzilla snarfer enabled by default?') == 'n':
onStart.append('Bugzilla config bug-snarfer off')
print 'The Bugzilla plugin has the functionality to watch for URLs'
print 'that match a specific pattern (we call this a snarfer). When'
print 'supybot sees such a URL, he will parse the web page for'
print 'information and reply with the results.\n'
if yn('Do you want this bug snarfer enabled by default?') == 'y':
onStart.append('Bugzilla config bug-snarfer on')
replyNoBugzilla = 'I don\'t have a bugzilla %r'
@ -87,7 +86,7 @@ class Bugzilla(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
threaded = True
regexps = ['bzSnarfer']
configurables = plugins.ConfigurableDictionary(
[('bug-snarfer', plugins.ConfigurableBoolType, True,
[('bug-snarfer', plugins.ConfigurableBoolType, False,
"""Determines whether the bug snarfer will be enabled, such that any
Bugzilla URLs seen in the channel will have their information reported
into the channel.""")]

View File

@ -61,8 +61,8 @@ def configure(onStart, afterConnect, advanced):
print 'that match a specific pattern (we call this a snarfer). When'
print 'supybot sees such a URL, he will parse the web page for'
print 'information and reply with the results.\n'
if yn('Do you want the Ebay snarfer enabled by default?') == 'n':
onStart.append('Ebay config auction-snarfer off')
if yn('Do you want the Ebay snarfer enabled by default?') == 'y':
onStart.append('Ebay config auction-snarfer on')
class EbayError(callbacks.Error):
pass
@ -75,7 +75,7 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
threaded = True
regexps = ['ebaySnarfer']
configurables = plugins.ConfigurableDictionary(
[('auction-snarfer', plugins.ConfigurableBoolType, True,
[('auction-snarfer', plugins.ConfigurableBoolType, False,
"""Determines whether the bot will automatically 'snarf' Ebay auction
URLs and print information about them.""")]
)

View File

@ -72,12 +72,14 @@ def configure(onStart, afterConnect, advanced):
print 'The Google plugin has the functionality to watch for URLs'
print 'that match a specific pattern (we call this a snarfer).'
print 'When supybot sees such a URL, he will parse the web page'
print 'for information and reply with the results.\n'
print 'for information and reply with the results.'
print
print 'Google has two available snarfers: Google Groups link'
print 'snarfing and a google search snarfer.\n'
print 'snarfing and a google search snarfer.'
print
if yn('Do you want the Google Groups link snarfer enabled by '
'default?') == 'n':
onStart.append('Google config groups-snarfer off')
'default?') == 'y':
onStart.append('Google config groups-snarfer on')
if yn('Do you want the Google search snarfer enabled by default?')\
== 'y':
onStart.append('Google config search-snarfer on')
@ -122,7 +124,7 @@ class Google(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
threaded = True
regexps = sets.Set(['googleSnarfer', 'googleGroups'])
configurables = plugins.ConfigurableDictionary(
[('groups-snarfer', plugins.ConfigurableBoolType, True,
[('groups-snarfer', plugins.ConfigurableBoolType, False,
"""Determines whether the groups snarfer is enabled. If so, URLs at
groups.google.com will be snarfed and their group/title messaged to
the channel."""),

View File

@ -69,12 +69,16 @@ def configure(onStart, afterConnect, advanced):
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn
onStart.append('load Python')
if yn("""This plugin provides a snarfer for ASPN Python Recipe URLs;
it will output the name of the Recipe when it sees such a URL.
Would you like to enable this snarfer?""") == 'y':
onStart.append('python config aspn-snarfer on')
class Python(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
modulechars = '%s%s%s' % (string.ascii_letters, string.digits, '_.')
regexps = ['aspnRecipes']
configurables = plugins.ConfigurableDictionary(
[('aspn-snarfer', plugins.ConfigurableBoolType, True,
[('aspn-snarfer', plugins.ConfigurableBoolType, False,
"""Determines whether the ASPN Python recipe snarfer is enabled. If
so, it will message the channel with the name of the recipe when it
sees an ASPN Python recipe link on the channel.""")]

View File

@ -61,13 +61,31 @@ def configure(onStart, afterConnect, advanced):
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn
onStart.append('load URL')
if yn("""This plugin offers a snarfer that will go to tinyurl.com and get
a shorter version of long URLs that are sent to the channel.
Would you like this snarfer to be enabled?""") == 'y':
onStart.append('url config tinyurl-snarfer on')
if advanced:
x = anything("""What would you like to be the minimum URL length
that will trigger this snarfer?""")
if not x:
x = '46'
while True:
try:
i = int(x)
onStart.append('url config tinyurl-minimum-length %s' % i)
return
except ValueError:
print 'That\'s not a valid integer.'
x = anything("""What would you like to be the minimum URL
length that will trigger this snarfer?""")
class URL(callbacks.PrivmsgCommandAndRegexp,
plugins.Configurable,
plugins.ChannelDBHandler):
regexps = ['tinyurlSnarfer']
configurables = plugins.ConfigurableDictionary(
[('tinyurl-snarfer', plugins.ConfigurableBoolType, True,
[('tinyurl-snarfer', plugins.ConfigurableBoolType, False,
"""Determines whether the bot will output shorter versions of URLs
longer than the tinyurl-minimum-length config variable."""),
('tinyurl-minimum-length', plugins.ConfigurableIntType, 46,