new config option: commentRequest.type

For decide which events should trigger a comment request.
This commit is contained in:
Elián Hanisch 2010-03-17 07:14:07 -03:00
parent 5176697e2e
commit 43485fdc0f
2 changed files with 14 additions and 0 deletions

View File

@ -15,6 +15,14 @@
import supybot.conf as conf
import supybot.registry as registry
class ValidTypes(registry.OnlySomeStrings):
"""Invalid type, valid types are: 'removal', 'ban' or 'quiet'."""
validStrings = ('removal', 'ban', 'quiet')
class SpaceSeparatedListOfTypes(registry.SpaceSeparatedListOf):
Value = ValidTypes
def configure(advanced):
conf.registerPlugin('Bantracker', True)
@ -27,6 +35,9 @@ conf.registerGlobalValue(Bantracker, 'bansite',
registry.String('', "Web site for the bantracker, without the 'bans.cgi' appended", private=True))
conf.registerGroup(Bantracker, 'commentRequest')
conf.registerChannelValue(Bantracker.commentRequest, 'type',
SpaceSeparatedListOfTypes(['removal', 'ban', 'quiet'],
"List of events for which the bot should request a comment."))
conf.registerChannelValue(Bantracker.commentRequest, 'ignore',
registry.SpaceSeparatedListOfStrings([],
"List of nicks for which the bot won't request to comment a ban/quiet/removal."\

View File

@ -351,6 +351,9 @@ class Bantracker(callbacks.Plugin):
type = 'ban'
else:
type = 'removal'
# check if type is enabled
if type not in self.registryValue('commentRequest.type', channel=channel):
return
# send msg
prefix = conf.supybot.reply.whenAddressedBy.chars()[0] # prefix char for commands
# check to who send the request