Lots of wizard updates. Still have to get rid of the onStart and

afterConnect stuff though.
This commit is contained in:
Stéphan Kochen 2004-01-31 22:24:43 +00:00
parent 03c46445d7
commit 5957eaad5d
20 changed files with 154 additions and 182 deletions

View File

@ -50,20 +50,17 @@ import callbacks
def configure(advanced): def configure(advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
print 'To use Amazon\'s Web Services, you must have a license key.' output('To use Amazon\'s Web Services, you must have a license key.')
if yn('Do you have a license key?') == 'y': if yn('Do you have a license key?'):
key = anything('What is it?') key = anything('What is it?')
conf.registerPlugin('Amazon', True) conf.registerPlugin('Amazon', True)
conf.supybot.plugins.Amazon.licenseKey.set(key) conf.supybot.plugins.Amazon.licenseKey.set(key)
else: else:
print 'You\'ll need to get a key before you can use this plugin.' output("""You'll need to get a key before you can use this plugin.
print 'You can apply for a key at http://www.amazon.com/webservices/' You can apply for a key at
http://www.amazon.com/webservices/""")
class LicenseKey(registry.String): class LicenseKey(registry.String):
def set(self, s): def set(self, s):

View File

@ -51,7 +51,7 @@ import callbacks
def configure(advanced): def configure(advanced):
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('BadWords', True) conf.registerPlugin('BadWords', True)
while yn('Would you like to add some bad words?') == 'y': while yn('Would you like to add some bad words?'):
words = anything('What words? (separate individual words by spaces)') words = anything('What words? (separate individual words by spaces)')
onStart.append('badwords add %s' % words) onStart.append('badwords add %s' % words)

View File

@ -93,11 +93,11 @@ class BugzillaError(Exception):
def configure(advanced): def configure(advanced):
from questions import expect, anything, yn from questions import expect, anything, yn
conf.registerPlugin('Bugzilla', True) conf.registerPlugin('Bugzilla', True)
print 'The Bugzilla plugin has the functionality to watch for URLs' output("""The Bugzilla plugin has the functionality to watch for URLs
print 'that match a specific pattern (we call this a snarfer). When' that match a specific pattern (we call this a snarfer). When
print 'supybot sees such a URL, he will parse the web page for' supybot sees such a URL, he will parse the web page for
print 'information and reply with the results.\n' information and reply with the results.""")
if yn('Do you want this bug snarfer enabled by default?') == 'y': if yn('Do you want this bug snarfer enabled by default?', default=False):
conf.supybot.plugins.Bugzilla.bugSnarfer.setValue(True) conf.supybot.plugins.Bugzilla.bugSnarfer.setValue(True)
conf.registerPlugin('Bugzilla') conf.registerPlugin('Bugzilla')

View File

@ -58,29 +58,25 @@ import callbacks
def configure(advanced): def configure(advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Debian', True) conf.registerPlugin('Debian', True)
if not utils.findBinaryInPath('zegrep'): if not utils.findBinaryInPath('zegrep'):
if not advanced: if not advanced:
print 'I can\'t find zegrep in your path. This is necessary ' output("""I can't find zegrep in your path. This is necessary
print 'to run the file command. I\'ll disable this command ' to run the file command. I'll disable this command
print 'now. When you get zegrep in your path, use the command ' now. When you get zegrep in your path, use the command
print '"enable file" to re-enable the command.' "enable file" to re-enable the command.""")
onStart.append('disable file') onStart.append('disable file')
else: else:
print 'I can\'t find zegrep in your path. If you want to run the ' output("""I can't find zegrep in your path. If you want to run
print 'file command with any sort of expediency, you\'ll need ' the file command with any sort of expediency, you'll
print 'it. You can use a python equivalent, but it\'s about two ' need it. You can use a python equivalent, but it's
print 'orders of magnitude slower. THIS MEANS IT WILL TAKE AGES ' about two orders of magnitude slower. THIS MEANS IT
print 'TO RUN THIS COMMAND. Don\'t do this.' WILL TAKE AGES TO RUN THIS COMMAND. Don't do this.""")
if yn('Do you want to use a Python equivalent of zegrep?') == 'y': if yn('Do you want to use a Python equivalent of zegrep?'):
conf.supybot.plugins.Debian.pythonZegrep.setValue(True) conf.supybot.plugins.Debian.pythonZegrep.setValue(True)
else: else:
print 'I\'ll disable file now.' output('I\'ll disable file now.')
onStart.append('disable file') onStart.append('disable file')
conf.registerPlugin('Debian') conf.registerPlugin('Debian')

View File

@ -54,8 +54,8 @@ import callbacks
def configure(advanced): def configure(advanced):
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
print 'The default dictd server is dict.org.' output('The default dictd server is dict.org.')
if yn('Would you like to specify a different dictd server?') == 'y': if yn('Would you like to specify a different dictd server?'):
server = something('What server?') server = something('What server?')
conf.supybot.plugins.Dict.server.set(server) conf.supybot.plugins.Dict.server.set(server)

View File

@ -53,17 +53,13 @@ import callbacks
def configure(advanced): def configure(advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Ebay', True) conf.registerPlugin('Ebay', True)
print 'The Ebay plugin has the functionality to watch for URLs' output("""The Ebay plugin has the functionality to watch for URLs
print 'that match a specific pattern (we call this a snarfer). When' that match a specific pattern (we call this a snarfer). When
print 'supybot sees such a URL, he will parse the web page for' supybot sees such a URL, he will parse the web page for
print 'information and reply with the results.\n' information and reply with the results."""
if yn('Do you want the Ebay snarfer enabled by default?') == 'y': if yn('Do you want the Ebay snarfer enabled by default?'):
conf.supybot.plugins.Ebay.auctionSnarfer.setValue(True) conf.supybot.plugins.Ebay.auctionSnarfer.setValue(True)
class EbayError(callbacks.Error): class EbayError(callbacks.Error):

View File

@ -53,12 +53,9 @@ def configure(advanced):
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Enforcer', True) conf.registerPlugin('Enforcer', True)
chanserv = anything("""What\'s the name of ChanServ on your network? If chanserv = anything("""What\'s the name of ChanServ on your network? If
there is no ChanServ on your network, just press enter without entering there is no ChanServ on your network, just press
anything.""") enter without entering anything.""")
if yn('Do you want the bot to take revenge on rule breakers?'): revenge = yn('Do you want the bot to take revenge on rule breakers?')
revenge = True
else:
revenge = False
conf.supybot.plugins.Enforcer.ChanServ.set(chanserv) conf.supybot.plugins.Enforcer.ChanServ.set(chanserv)
conf.supybot.plugins.Enforcer.takeRevenge.setValue(revenge) conf.supybot.plugins.Enforcer.takeRevenge.setValue(revenge)

View File

@ -52,22 +52,18 @@ import callbacks
def configure(advanced): def configure(advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Gameknot', True) conf.registerPlugin('Gameknot', True)
if advanced: if advanced:
print 'The Gameknot plugin has the functionality to watch for URLs' output("""The Gameknot plugin has the functionality to watch for URLs
print 'that match a specific pattern (we call this a snarfer). When' that match a specific pattern (we call this a snarfer). When
print 'supybot sees such a URL, he will parse the web page for' supybot sees such a URL, he will parse the web page for
print 'information and reply with the results.\n' information and reply with the results.""")
if yn('Do you want the Gameknot stats snarfer enabled by default?')==\ if yn('Do you want the Gameknot stats snarfer enabled by default?',
'y': default=False):
conf.supybot.plugins.Gameknot.statSnarfer.setValue(True) conf.supybot.plugins.Gameknot.statSnarfer.setValue(True)
if yn('Do you want the Gameknot Game links snarfer enabled by ' if yn('Do you want the Gameknot Game links snarfer enabled by '
'default?') == 'y': 'default?', default=False):
conf.supybot.plugins.Gameknot.gameSnarfer.setValue(True) conf.supybot.plugins.Gameknot.gameSnarfer.setValue(True)
conf.registerPlugin('Gameknot') conf.registerPlugin('Gameknot')

View File

@ -61,12 +61,12 @@ import structures
def configure(advanced): def configure(advanced):
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
print 'To use Google\'t Web Services, you must have a license key.' output('To use Google\'t Web Services, you must have a license key.')
if yn('Do you have a license key?') == 'y': if yn('Do you have a license key?'):
key = something('What is it?') key = something('What is it?')
while len(key) != 32: while len(key) != 32:
print 'That\'s not a valid Google license key.' output('That\'s not a valid Google license key.')
if yn('Are you sure you have a valid Google license key?') == 'y': if yn('Are you sure you have a valid Google license key?'):
key = something('What is it?') key = something('What is it?')
else: else:
key = '' key = ''
@ -74,34 +74,33 @@ def configure(advanced):
if key: if key:
conf.registerPlugin('Google', True) conf.registerPlugin('Google', True)
conf.supybot.plugins.Google.licenseKey.setValue(key) conf.supybot.plugins.Google.licenseKey.setValue(key)
print 'The Google plugin has the functionality to watch for URLs' output("""The Google plugin has the functionality to watch for URLs
print 'that match a specific pattern (we call this a snarfer).' that match a specific pattern. (We call this a snarfer)
print 'When supybot sees such a URL, he will parse the web page' When supybot sees such a URL, it will parse the web page
print 'for information and reply with the results.' for information and reply with the results.
print
print 'Google has two available snarfers: Google Groups link' Google has two available snarfers: Google Groups link
print 'snarfing and a google search snarfer.' snarfing and a google search snarfer.""")
print
if yn('Do you want the Google Groups link snarfer enabled by ' if yn('Do you want the Google Groups link snarfer enabled by '
'default?') == 'y': 'default?'):
conf.supybot.plugins.Google.groupsSnarfer.setValue(True) conf.supybot.plugins.Google.groupsSnarfer.setValue(True)
if yn('Do you want the Google search snarfer enabled by default?') \ if yn('Do you want the Google search snarfer enabled by default?'):
== 'y':
conf.supybot.plugins.Google.searchSnarfer.setValue(True) conf.supybot.plugins.Google.searchSnarfer.setValue(True)
if not conf.supybot.plugins.Alias(): if not conf.supybot.plugins.Alias():
print 'Google depends on the Alias module for some extra commands.' output('Google depends on the Alias module '
if yn('Would you like to load the Alias module now?') == 'y': 'for some extra commands.')
if yn('Would you like to load the Alias module now?'):
conf.registerPlugin('Alias', True) conf.registerPlugin('Alias', True)
else: else:
print 'You can still use the Google module, but you won\'t ' \ output('You can still use the Google module, but you won\'t '
'have these extra commands enabled.' 'have these extra commands enabled.')
return return
onStart.append('alias add googlelinux "google --restrict=linux $1"') onStart.append('alias add googlelinux "google --restrict=linux $1"')
onStart.append('alias add googlebsd "google --restrict=bsd $1"') onStart.append('alias add googlebsd "google --restrict=bsd $1"')
onStart.append('alias add googlemac "google --restrict=mac $1"') onStart.append('alias add googlemac "google --restrict=mac $1"')
else: else:
print 'You\'ll need to get a key before you can use this plugin.' output("""You'll need to get a key before you can use this plugin.
print 'You can apply for a key at http://www.google.com/apis/' You can apply for a key at http://www.google.com/apis/""")
totalSearches = 0 totalSearches = 0

View File

@ -56,26 +56,21 @@ except ImportError:
'plugin. Download it at <http://pysqlite.sf.net/>' 'plugin. Download it at <http://pysqlite.sf.net/>'
def configure(advanced): def configure(advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Lookup', True) conf.registerPlugin('Lookup', True)
print 'This module allows you to define commands that do a simple key' output("""This module allows you to define commands that do a simple key
print 'lookup and return some simple value. It has a command "add"' lookup and return some simple value. It has a command "add"
### TODO: fix conf.dataDir here. I'm waiting until we rewrite this with that takes a command name and a file from the data dir and adds a
### a proper question.py print statement. command with that name that responds with the mapping from that
print 'that takes a command name and a file in conf.dataDir and adds a' file. The file itself should be composed of lines
print 'command with that name that responds with mapping from that file.' of the form key:value.""")
print 'The file itself should be composed of lines of the form key:value.' while yn('Would you like to add a file?'):
while yn('Would you like to add a file?') == 'y':
filename = something('What\'s the filename?') filename = something('What\'s the filename?')
try: try:
dataDir = conf.supybot.directories.data() dataDir = conf.supybot.directories.data()
fd = file(os.path.join(dataDir, filename)) fd = file(os.path.join(dataDir, filename))
except EnvironmentError, e: except EnvironmentError, e:
print 'I couldn\'t open that file: %s' % e output('I couldn\'t open that file: %s' % e)
continue continue
counter = 1 counter = 1
try: try:
@ -86,7 +81,8 @@ def configure(advanced):
(key, value) = line.split(':', 1) (key, value) = line.split(':', 1)
counter += 1 counter += 1
except ValueError: except ValueError:
print 'That\'s not a valid file; line #%s is malformed.' % counter output('That\'s not a valid file; '
'line #%s is malformed.' % counter)
continue continue
command = something('What would you like the command to be?') command = something('What would you like the command to be?')
onStart.append('lookup add %s %s' % (command, filename)) onStart.append('lookup add %s %s' % (command, filename))

View File

@ -54,10 +54,10 @@ def configure(advanced):
conf.registerPlugin('Parter', True) conf.registerPlugin('Parter', True)
s = ' ' s = ' '
while s: while s:
if yn('Would you like to automatically part a channel?') == 'y': if yn('Would you like to automatically part a channel?'):
s = something('What channel?') s = something('What channel?')
while not ircutils.isChannel(s): while not ircutils.isChannel(s):
print 'That\'s not a valid channel.' output('That\'s not a valid channel.')
s = something('What channel?') s = something('What channel?')
onStart.append('autopartchannel %s' % s) onStart.append('autopartchannel %s' % s)
else: else:

View File

@ -70,7 +70,7 @@ def configure(advanced):
conf.registerPlugin('Python', True) conf.registerPlugin('Python', True)
if yn("""This plugin provides a snarfer for ASPN Python Recipe URLs; 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. it will output the name of the Recipe when it sees such a URL.
Would you like to enable this snarfer?""") == 'y': Would you like to enable this snarfer?"""):
conf.supybot.plugins.Python.aspnSnarfer.setValue(True) conf.supybot.plugins.Python.aspnSnarfer.setValue(True)
conf.registerPlugin('Python') conf.registerPlugin('Python')

View File

@ -55,7 +55,7 @@ def configure(advanced):
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('RSS', True) conf.registerPlugin('RSS', True)
prompt = 'Would you like to add an RSS feed?' prompt = 'Would you like to add an RSS feed?'
while yn(prompt) == 'y': while yn(prompt):
prompt = 'Would you like to add another RSS feed?' prompt = 'Would you like to add another RSS feed?'
name = something('What\'s the name of the website?') name = something('What\'s the name of the website?')
url = something('What\'s the URL of the RSS feed?') url = something('What\'s the URL of the RSS feed?')

View File

@ -57,40 +57,40 @@ def configure(advanced):
import socket import socket
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Relay', True) conf.registerPlugin('Relay', True)
startNetwork = anything('What is the name of the network you\'re ' \ startNetwork = anything('What is the name of the network you\'re '
'connecting to first?') 'connecting to first?')
onStart.append('relay start %s' % startNetwork) onStart.append('relay start %s' % startNetwork)
while yn('Do you want to connect to another network for relaying?') == 'y': while yn('Do you want to connect to another network for relaying?'):
network = anything('What is the name of the network you want to ' \ network = anything('What is the name of the network you want to '
'connect to?') 'connect to?')
server = '' server = ''
while not server: while not server:
server = anything('What server does that network use?') server = anything('What server does that network use?')
try: try:
print 'Looking up %s' % server output('Looking up %s' % server)
ip = socket.gethostbyname(server) ip = socket.gethostbyname(server)
print 'Found %s (%s)' % (server, ip) output('Found %s (%s)' % (server, ip))
except socket.error: except socket.error:
print 'Sorry, but I couldn\'t find that server.' output('Sorry, but I couldn\'t find that server.')
server = '' server = ''
if yn('Does that server require you to connect on a port other than ' if yn('Does that server require you to connect on a port other than '
'the default port for IRC (6667)?') == 'y': 'the default port for IRC (6667)?', default=False):
port = '' port = ''
while not port: while not port:
port = anything('What port is that?') port = anything('What port is that?')
try: try:
int(port) int(port)
except ValueError: except ValueError:
print 'Sorry, but that isn\'t a valid port.' output('Sorry, but that isn\'t a valid port.')
port = '' port = ''
server = ':'.join((server, port)) server = ':'.join((server, port))
onStart.append('relay connect %s %s' % (network, server)) onStart.append('relay connect %s %s' % (network, server))
channel = anything('What channel would you like to relay between?') channel = anything('What channel would you like to relay between?')
afterConnect.append('relay join %s' % utils.dqrepr(channel)) afterConnect.append('relay join %s' % utils.dqrepr(channel))
while yn('Would like to relay between any more channels?') == 'y': while yn('Would like to relay between any more channels?'):
channel = anything('What channel?') channel = anything('What channel?')
afterConnect.append('relay join %s' % channel) afterConnect.append('relay join %s' % channel)
if yn('Would you like to use color to distinguish between nicks?') == 'y': if yn('Would you like to use color to distinguish between nicks?'):
afterConnect.append('relay color 2') afterConnect.append('relay color 2')

View File

@ -53,12 +53,8 @@ def configure(advanced):
conf.registerPlugin('Services', True) conf.registerPlugin('Services', True)
nick = something('What is your registered nick?') nick = something('What is your registered nick?')
password = something('What is your password for that nick?') password = something('What is your password for that nick?')
chanserv = 'ChanServ' chanserv = something('What is your ChanServ named?', default='ChanServ')
if yn('Is your ChanServ named something other than ChanServ?') == 'y': nickserv = something('What is your NickServ named?', default='NickServ')
chanserv = something('What is your ChanServ named?')
nickserv = 'NickServ'
if yn('Is your NickServ named something other than NickServ?') == 'y':
nickserv = something('What is your NickServ named?')
conf.supybot.plugins.Services.nick.setValue(nick) conf.supybot.plugins.Services.nick.setValue(nick)
conf.supybot.plugins.Services.password.setValue(password) conf.supybot.plugins.Services.password.setValue(password)
conf.supybot.plugins.Services.NickServ.setValue(nickserv) conf.supybot.plugins.Services.NickServ.setValue(nickserv)

View File

@ -53,44 +53,42 @@ import callbacks
def configure(advanced): def configure(advanced):
# This will be called by setup.py to configure this module. onStart and
# afterConnect are both lists. Append to onStart the commands you would
# like to be run when the bot is started; append to afterConnect the
# commands you would like to be run when the bot has finished connecting.
from questions import expect, anything, something, yn from questions import expect, anything, something, yn
conf.registerPlugin('Sourceforge', True) conf.registerPlugin('Sourceforge', True)
print 'The Sourceforge plugin has the functionality to watch for URLs' output("""The Sourceforge plugin has the functionality to watch for URLs
print 'that match a specific pattern (we call this a snarfer). When' that match a specific pattern (we call this a snarfer). When
print 'supybot sees such a URL, he will parse the web page for' supybot sees such a URL, he will parse the web page for
print 'information and reply with the results.\n' information and reply with the results.""")
if yn('Do you want this snarfer to be enabled by default?') == 'y': if yn('Do you want this snarfer to be enabled by default?'):
conf.supybot.plugins.Sourceforge.trackerSnarfer.setValue(True) conf.supybot.plugins.Sourceforge.trackerSnarfer.setValue(True)
print 'The bugs and rfes commands of the Sourceforge plugin can be set' output("""The bugs and rfes commands of the Sourceforge plugin can be set
print 'to query a default project when no project is specified. If this' to query a default project when no project is specified. If this
print 'project is not set, calling either of those commands will display' project is not set, calling either of those commands will display
print 'the associated help. With the default project set, calling' the associated help. With the default project set, calling
print 'bugs/rfes with no arguments will find the most recent bugs/rfes' bugs/rfes with no arguments will find the most recent bugs/rfes
print 'for the default project.\n' for the default project.""")
if yn('Do you want to specify a default project?') == 'y': if yn('Do you want to specify a default project?'):
project = anything('Project name:') project = anything('Project name:')
if project: if project:
conf.supybot.plugins.Sourceforge.project.set(project) conf.supybot.plugins.Sourceforge.project.set(project)
print 'Sourceforge is quite the word to type, and it may get annoying' output("""Sourceforge is quite the word to type, and it may get annoying
print 'typing it all the time because Supybot makes you use the plugin' typing it all the time because Supybot makes you use the plugin
print 'name to disambiguate calls to ambiguous commands (i.e., the bug' name to disambiguate calls to ambiguous commands (i.e., the bug
print 'command is in this plugin and the Bugzilla plugin; if both are' command is in this plugin and the Bugzilla plugin; if both are
print 'loaded, you\'ll have you type "sourceforge bug ..." to get this' loaded, you\'ll have you type "sourceforge bug ..." to get this
print 'bug command). You may save some time by making an alias for' bug command). You may save some time by making an alias for
print '"sourceforge". We like to make it "sf".' "sourceforge". We like to make it "sf"."""
if yn('Would you like to add sf as an alias for Sourceforge?') == 'y': if yn('Would you like to add sf as an alias for Sourceforge?',
default=True):
if not conf.supybot.plugins.Alias(): if not conf.supybot.plugins.Alias():
print 'This depends on the Alias module.' output('This depends on the Alias module.')
if yn('Would you like to load the Alias plugin now?') == 'y': if yn('Would you like to load the Alias plugin now?',
default=True):
conf.registerPlugin('Alias', True) conf.registerPlugin('Alias', True)
else: else:
print 'Then I can\'t add such an alias.' output('Then I can\'t add such an alias.')
return return
onStart.append('alias add sf sourceforge $*') onStart.append('alias add sf sourceforge $*')

View File

@ -66,11 +66,11 @@ def configure(advanced):
conf.registerPlugin('URL', True) conf.registerPlugin('URL', True)
if yn("""This plugin offers a snarfer that will go to tinyurl.com and get 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. a shorter version of long URLs that are sent to the channel.
Would you like this snarfer to be enabled?"""): Would you like this snarfer to be enabled?""", default=False):
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(True) conf.supybot.plugins.URL.tinyurlSnarfer.setValue(True)
if yn("""This plugin also offers a snarfer that will try to fetch the if yn("""This plugin also offers a snarfer that will try to fetch the
title of URLs that it sees in the channel. Would like you this title of URLs that it sees in the channel. Would like you this
snarfer to be enabled?"""): snarfer to be enabled?""", default=False):
conf.supybot.plugins.URL.titleSnarfer.setValue(True) conf.supybot.plugins.URL.titleSnarfer.setValue(True)
conf.registerPlugin('URL') conf.registerPlugin('URL')

View File

@ -61,32 +61,32 @@ def configure(advanced):
if not spellCmd: if not spellCmd:
spellCmd = utils.findBinaryInPath('ispell') spellCmd = utils.findBinaryInPath('ispell')
if not spellCmd: if not spellCmd:
print 'NOTE: I couldn\'t find aspell or ispell in your path,' output("""NOTE: I couldn't find aspell or ispell in your path, so that
print 'so that function of this module will not work. You may' function of this module will not work. You may choose to
print 'choose to install it later. To re-enable this command then, ' install it later. To re-enable this command then, remove
print 'remove the "disable spell" line from your configuration file.' the "disable spell" line from your configuration file.""")
onStart.append('disable spell') onStart.append('disable spell')
fortuneCmd = utils.findBinaryInPath('fortune') fortuneCmd = utils.findBinaryInPath('fortune')
if not fortuneCmd: if not fortuneCmd:
print 'NOTE: I couldn\'t find fortune in your path, so that function ' output("""NOTE: I couldn't find fortune in your path, so that function
print 'of this module will not work. You may choose to install it ' of this module will not work. You may choose to install it
print 'later. To re-enable this command then, remove the ' later. To re-enable this command then, remove the
print '"disable fortune" command from your configuration file.' '"disable fortune" command from your configuration file.""")
onStart.append('disable fortune') onStart.append('disable fortune')
wtfCmd = utils.findBinaryInPath('wtf') wtfCmd = utils.findBinaryInPath('wtf')
if not wtfCmd: if not wtfCmd:
print 'NOTE: I couldn\'t find wtf in your path, so that function of ' output("""NOTE: I couldn't find wtf in your path, so that function of
print 'this module won\'t work. You may choose to install it later; ' this module won't work. You may choose to install it later;
print 'to re-enable this command then, remove the "disable wtf" ' to re-enable this command then, remove the "disable wtf"
print 'command from your configuration file or simply tell the bot ' command from your configuration file or simply tell the bot
print '"enable wtf"' "enable wtf" instead.""")
onStart.append('disable wtf') onStart.append('disable wtf')
print 'The "progstats" command can reveal potentially sensitive' output("""The "progstats" command can reveal potentially sensitive
print 'information about your machine. Here\'s an example of its output:' information about your machine. Here's an example of its output:
print
print progstats() %s\n""" % progstats())
print if yn('Would you like to disable this command for non-owner users?',
if yn('Would you like to disable this command for non-owner users?')=='y': default=True):
onStart.append('disable progstats') onStart.append('disable progstats')
def progstats(): def progstats():

View File

@ -69,8 +69,8 @@ def main():
import log import log
import ircdb import ircdb
oldPriority = conf.supybot.log.minimumPriority() oldLogLevel = conf.supybot.log.level()
conf.supybot.log.minimumPriority.set('CRITICAL') conf.supybot.log.level.set('CRITICAL')
if not options.name: if not options.name:
name = '' name = ''
@ -124,7 +124,7 @@ def main():
user.addCapability(capability) user.addCapability(capability)
ircdb.users.setUser(id, user) ircdb.users.setUser(id, user)
print 'User %s added.' % name print 'User %s added.' % name
conf.supybot.log.minimumPriority.setValue(oldPriority) conf.supybot.log.level.setValue(oldLogLevel)
registry.close(conf.supybot, args[0]) registry.close(conf.supybot, args[0])
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -225,10 +225,10 @@ def main():
# Store the minimum log priority if set, because we set it to a temporary # Store the minimum log priority if set, because we set it to a temporary
# value during the wizard # value during the wizard
try: try:
priority = registry._cache['supybot.log.minimumPriority'] priority = registry._cache['supybot.log.level']
except KeyError: except KeyError:
priority = 'INFO' priority = 'INFO'
registry._cache['supybot.log.minimumPriority'] = 'CRITICAL' registry._cache['supybot.log.level'] = 'CRITICAL'
# Now that we're all set, import conf and log # Now that we're all set, import conf and log
import conf import conf
@ -364,17 +364,18 @@ def main():
world unless you can make that bot join some channels.""") world unless you can make that bot join some channels.""")
if yn('Do you want your bot to join some channels when he connects?', if yn('Do you want your bot to join some channels when he connects?',
default=True): default=True):
defaultChannels = ','.join(conf.supybot.channels()) defaultChannels = ' '.join(conf.supybot.channels())
while True:
channels = something('What channels? Separate channels with ' channels = something('What channels? Separate channels with '
'commas.', default=defaultChannels) 'spaces.', default=defaultChannels)
while not all(ircutils.isChannel, channels.split(',')): try:
conf.supybot.channels.set(channels)
break
except registry.InvalidRegistryValue:
# FIXME: say which ones weren't channels. # FIXME: say which ones weren't channels.
output("""Not all of those are valid IRC channels. Be sure to output("""Not all of those are valid IRC channels. Be sure to
prefix the channel with # (or +, or !, or &, but no one uses those prefix the channel with # (or +, or !, or &, but no one uses those
channels, really).""") channels, really).""")
channels = something('What channels?',
default=defaultChannels)
conf.supybot.channels.set(channels)
### ###
# Plugins # Plugins
@ -535,19 +536,19 @@ def main():
not yn('Would you like to turn this colorization off?', not yn('Would you like to turn this colorization off?',
default=False)) default=False))
# conf.supybot.log.minimumPriority # conf.supybot.log.level
output("""Your bot can handle debug messages at several priorities, output("""Your bot can handle debug messages at several priorities,
CRITICAL, in decreasing order of priority. By CRITICAL, in decreasing order of priority. By
default, your bot will log all of these priorities. You can, however, default, your bot will log all of these priorities. You can, however,
specify that he only log messages above a certain priority level. Of specify that he only log messages above a certain priority level. Of
course, all error messages will still be logged.""") course, all error messages will still be logged.""")
newPriority = something('What would you like the minimum priority to be? ' newLogLevel = something('What would you like the minimum priority to be? '
'Just press enter to accept the default.', 'Just press enter to accept the default.',
default=priority).lower() default=priority).lower()
while newPriority not in ['debug', 'info', 'warning', 'error', 'critical']: while newLogLevel not in ['debug', 'info', 'warning', 'error', 'critical']:
output("""That's not a valid priority. Valid priorities include output("""That's not a valid priority. Valid priorities include
'DEBUG', 'INFO', 'WARNING', 'ERROR', and 'CRITICAL'""") 'DEBUG', 'INFO', 'WARNING', 'ERROR', and 'CRITICAL'""")
newPriority = something('What would you like the minimum priority to ' newLogLevel = something('What would you like the minimum priority to '
'be? Just press enter to accept the default.', 'be? Just press enter to accept the default.',
default=priority).lower() default=priority).lower()
@ -640,8 +641,8 @@ def main():
### ###
# Write the registry # Write the registry
### ###
# Replace the temporary value in supybot.log.minimumPriority # Replace the temporary value in supybot.log.level
conf.supybot.log.minimumPriority.set(newPriority) conf.supybot.log.level.set(newLogLevel)
# Save the registry # Save the registry
if not filename: if not filename: