Make configure() do something for all plugins, also fix a couple of things from r197-203
This commit is contained in:
@ -39,7 +39,7 @@ def configure(advanced):
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('Bantracker', True)
|
||||
Bantracker = conf.registerPlugin('Bantracker', True)
|
||||
|
||||
def getReviewTime():
|
||||
output("How many days should the bot wait before requesting a ban/quiet review?")
|
||||
@ -50,7 +50,7 @@ def configure(advanced):
|
||||
if review < 0:
|
||||
raise TypeError
|
||||
except TypeError:
|
||||
output("%r is an invalid value, it must be an integer or float greater or equal to 0", review)
|
||||
output("%r is an invalid value, it must be an integer or float greater or equal to 0" % review)
|
||||
return getReviewTime()
|
||||
else:
|
||||
return review
|
||||
|
@ -22,14 +22,51 @@ class Bugtrackers(registry.SpaceSeparatedListOfStrings):
|
||||
List = ircutils.IrcSet
|
||||
|
||||
def configure(advanced):
|
||||
from supybot.questions import expect, something, yn
|
||||
from supybot.questions import expect, something, yn, output
|
||||
|
||||
def anything(prompt, default=None):
|
||||
"""Because supybot is pure fail"""
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('Bugtracker', True)
|
||||
Bugtracker = conf.registerPlugin('Bugtracker', True)
|
||||
|
||||
def getRepeatdelay():
|
||||
output("How many seconds should the bot wait before repeating bug information?")
|
||||
repeatdelay = something("Enter a number greater or equal to 0", default=Bugtracker.repeatdelay._default)
|
||||
|
||||
try:
|
||||
repeatdelay = int(repeatdelay)
|
||||
if repeatdelay < 0:
|
||||
raise TypeError
|
||||
except TypeError:
|
||||
output("%r is an invalid value, it must be an integer greater or equal to 0" % repeatdelay)
|
||||
return getRepeatdelay()
|
||||
else:
|
||||
return repeatdelay
|
||||
|
||||
bugSnarfer = yn("Enable detecting bugs numbers and URL in all channels?", default=Bugtracker.bugSnarfer._default)
|
||||
if advanced:
|
||||
replyNoBugtracker = something("What should the bot reply with when a a user requests information from an unknown bug tracker?", default=Bugtracker.replyNoBugtracker._default)
|
||||
snarfTarget = something("What should be the default bug tracker used when one isn't specified?", default=Bugtracker.snarfTarget._default)
|
||||
replyWhenNotFound = yn("Respond when a bug is not found?", default=Bugtracker.replyWhenNotFound._default)
|
||||
repeatdelay = getRepeatdelay()
|
||||
else:
|
||||
replyNoBugtracker = Bugtracker.replyNoBugtracker._default
|
||||
snarfTarget = Bugtracker.snarfTarget._default
|
||||
replyWhenNotFound = Bugtracker.replyWhenNotFound._default
|
||||
repeatdelay = Bugtracker.repeatdelay._default
|
||||
|
||||
showassignee = yn("Show the assignee of a bug in the reply?", default=Bugtracker.showassignee._default)
|
||||
extended = yn("Show tracker-specific extended infomation?", default=Bugtracker.extended._default)
|
||||
|
||||
Bugtracker.bugSnarfer.setValue(bugSnarfer)
|
||||
Bugtracker.replyNoBugtracker.setValue(replyNoBugtracker)
|
||||
Bugtracker.snarfTarget.setValue(snarfTarget)
|
||||
Bugtracker.replyWhenNotFound.setValue(replyWhenNotFound)
|
||||
Bugtracker.repeatdelay.setValue(repeatdelay)
|
||||
Bugtracker.showassignee.setValue(showassignee)
|
||||
Bugtracker.extended.setValue(extended)
|
||||
|
||||
Bugtracker = conf.registerPlugin('Bugtracker')
|
||||
|
||||
@ -38,7 +75,7 @@ conf.registerChannelValue(Bugtracker, 'bugSnarfer',
|
||||
enabled, such that any Bugtracker URLs and bug ### seen in the channel
|
||||
will have their information reported into the channel."""))
|
||||
|
||||
conf.registerChannelValue(conf.supybot.plugins.Bugtracker, 'bugReporter',
|
||||
conf.registerChannelValue(Bugtracker, 'bugReporter',
|
||||
registry.String('', """Report new bugs (experimental)"""))
|
||||
|
||||
conf.registerChannelValue(Bugtracker, 'replyNoBugtracker',
|
||||
@ -47,7 +84,7 @@ conf.registerChannelValue(Bugtracker, 'replyNoBugtracker',
|
||||
bugtracker site."""))
|
||||
|
||||
conf.registerChannelValue(Bugtracker, 'snarfTarget',
|
||||
registry.String('', """Determines the bugtracker to query when the
|
||||
registry.String('lp', """Determines the bugtracker to query when the
|
||||
snarf command is triggered"""))
|
||||
|
||||
conf.registerGlobalValue(Bugtracker, 'bugtrackers',
|
||||
|
@ -24,7 +24,20 @@ def configure(advanced):
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('IRCLogin', True)
|
||||
IRCLogin = conf.registerPlugin('IRCLogin', True)
|
||||
|
||||
if advanced:
|
||||
## NOTE: This is currently disabled until rewritten to use launchpadlib
|
||||
#UserList = anything("What file should be used to contains the list of users?", default=conf.supybot.directories.data.dirize("users.db"))
|
||||
#teamname = something("What is the Launchpad team name to get the list of users from?", default=IRCLogin.teamname._default)
|
||||
UserList = IRCLogin.UserList._default
|
||||
teamname = IRCLogin.teamname._default
|
||||
else:
|
||||
UserList = IRCLogin.UserList._default
|
||||
teamname = IRCLogin.teamname._default
|
||||
|
||||
IRCLogin.UserList.setValue(UserList)
|
||||
IRCLogin.teamname.setValue(teamname)
|
||||
|
||||
IRCLogin = conf.registerPlugin('IRCLogin')
|
||||
conf.registerGlobalValue(IRCLogin, 'UserList',
|
||||
|
@ -44,8 +44,16 @@ def configure(advanced):
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('Lart', True)
|
||||
Lart = conf.registerPlugin('Lart', True)
|
||||
|
||||
enabled = yn("Enable Lart for all channels?", default=Lart.enabled._default)
|
||||
if advanced:
|
||||
showIds = yn("Show the ID of a lart when it is shown?", default=Lart.showIds._default)
|
||||
else:
|
||||
showIds = Lart.showIds._default
|
||||
|
||||
Lart.enabled.setValue(enabled)
|
||||
Lart.showIds.setValue(showIds)
|
||||
|
||||
Lart = conf.registerPlugin('Lart')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
|
@ -17,14 +17,33 @@ import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
|
||||
def configure(advanced):
|
||||
from supybot.questions import expect, something, yn
|
||||
from supybot.questions import expect, something, yn, output
|
||||
|
||||
def anything(prompt, default=None):
|
||||
"""Because supybot is pure fail"""
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('Mess', True)
|
||||
Mess = conf.registerPlugin('Mess', True)
|
||||
|
||||
def getDelay():
|
||||
output("What should be the minimum number of seconds between mess output?")
|
||||
delay = something("Enter an integer greater or equal to 0", default=Mess.delay._default)
|
||||
|
||||
try:
|
||||
delay = int(delay)
|
||||
if delay < 0:
|
||||
raise TypeError
|
||||
except TypeError:
|
||||
output("%r is not a valid value, it must be an interger greater or equal to 0" % delay)
|
||||
return getDelay()
|
||||
else:
|
||||
return delay
|
||||
|
||||
output("WARNING: This plugin is unmaintained, may have bugs and is potentially offensive to users")
|
||||
Mess.enabled.setValue(yn("Enable this plugin for all channels?", default=Mess.enabled._default))
|
||||
Mess.offensive.setValue(yn("Enable possibly offensive content?", default=Mess.offensive._default))
|
||||
Mess.delay.setValue(getDelay())
|
||||
|
||||
Mess = conf.registerPlugin('Mess')
|
||||
conf.registerChannelValue(conf.supybot.plugins.Mess, 'enabled',
|
||||
|
@ -36,7 +36,7 @@ deb-src http://archive.ubuntu.com/ubuntu/ %s main restricted universe multiverse
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('PackageInfo', True)
|
||||
PackageInfo = conf.registerPlugin('PackageInfo', True)
|
||||
|
||||
enabled = yn("Enable this plugin in all channels?", default=True)
|
||||
|
||||
|
@ -17,14 +17,35 @@ import supybot.conf as conf
|
||||
import supybot.registry as registry
|
||||
|
||||
def configure(advanced):
|
||||
from supybot.questions import expect, something, yn
|
||||
from supybot.questions import expect, something, yn, output
|
||||
|
||||
def anything(prompt, default=None):
|
||||
"""Because supybot is pure fail"""
|
||||
from supybot.questions import expect
|
||||
return expect(prompt, [], default=default)
|
||||
|
||||
conf.registerPlugin('Webcal', True)
|
||||
Webcal = conf.registerPlugin('Webcal', True)
|
||||
|
||||
output("Every option, except for the default channel and URL to a list of time zones, is channel-specific.")
|
||||
output("The values you enter here will be the defaults unless overridden by a channel-specific value")
|
||||
doTopic = yn("Manage the topic for all channels?", default=Webcal.doTopic._default)
|
||||
url = anything("What is the default URL to the iCal feed, for all channels?", default=Webcal.url._default)
|
||||
defaultChannel = anything("What channel should be default when none is given?", default=Webcal.defaultChannel._default)
|
||||
tzUrl = anything("What is the URL to the list of available time zonez?", default=Webcal.tzUrl._default)
|
||||
|
||||
if advanced:
|
||||
filter = anything("What should the filter be for the iCal feed, for all channels?", default=Webcal.filter._default)
|
||||
topic = anything("What template should be used for the topic, for all channels", default=Webcal.topic._default)
|
||||
else:
|
||||
filter = Webcal.filter._default
|
||||
topic = Webcal.topic._default
|
||||
|
||||
Webcal.doTopic.setValue(doTopic)
|
||||
Webcal.url.setValue(url)
|
||||
Webcal.defaultChannel.setValue(defaultChannel)
|
||||
Webcal.tzUrl.setValue(tzUrl)
|
||||
Webcal.filter.setValue(filter)
|
||||
Webcal.topic.setValue(topic)
|
||||
|
||||
Webcal = conf.registerPlugin('Webcal')
|
||||
conf.registerChannelValue(conf.supybot.plugins.Webcal, 'url',
|
||||
@ -38,4 +59,4 @@ conf.registerChannelValue(conf.supybot.plugins.Webcal, 'doTopic',
|
||||
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'defaultChannel',
|
||||
registry.String('',"""Default channel to determine schedule for /msg replies"""))
|
||||
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'tzUrl',
|
||||
registry.String('', """URL to the list of timezones supported by the Webcal plugin"""))
|
||||
registry.String('http://ubottu.com/timezones.html', """URL to the list of timezones supported by the Webcal plugin"""))
|
||||
|
Reference in New Issue
Block a user