mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
BadWords: Make configuration variable requireWordBoundaries channel-specific
This commit is contained in:
parent
fcfa483efe
commit
123c176637
@ -52,7 +52,7 @@ BadWords = conf.registerPlugin('BadWords')
|
|||||||
conf.registerGlobalValue(BadWords, 'words',
|
conf.registerGlobalValue(BadWords, 'words',
|
||||||
LastModifiedSetOfStrings([], _("""Determines what words are
|
LastModifiedSetOfStrings([], _("""Determines what words are
|
||||||
considered to be 'bad' so the bot won't say them.""")))
|
considered to be 'bad' so the bot won't say them.""")))
|
||||||
conf.registerGlobalValue(BadWords,'requireWordBoundaries',
|
conf.registerChannelValue(BadWords,'requireWordBoundaries',
|
||||||
registry.Boolean(False, _("""Determines whether the bot will require bad
|
registry.Boolean(False, _("""Determines whether the bot will require bad
|
||||||
words to be independent words, or whether it will censor them within other
|
words to be independent words, or whether it will censor them within other
|
||||||
words. For instance, if 'darn' is a bad word, then if this is true, 'darn'
|
words. For instance, if 'darn' is a bad word, then if this is true, 'darn'
|
||||||
|
@ -104,7 +104,7 @@ class BadWords(callbacks.Privmsg):
|
|||||||
|
|
||||||
def makeRegexp(self, iterable):
|
def makeRegexp(self, iterable):
|
||||||
s = '(%s)' % '|'.join(map(re.escape, iterable))
|
s = '(%s)' % '|'.join(map(re.escape, iterable))
|
||||||
if self.registryValue('requireWordBoundaries'):
|
if self.registryValue('requireWordBoundaries', channel):
|
||||||
s = r'\b%s\b' % s
|
s = r'\b%s\b' % s
|
||||||
self.regexp = re.compile(s, re.I)
|
self.regexp = re.compile(s, re.I)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user