If censor list is empty, don't censor
This commit is contained in:
parent
e764890636
commit
52a1e58db1
|
@ -20,6 +20,7 @@ def censor(text):
|
|||
text = text.replace('\n', '').replace('\r', '')
|
||||
replacement = '[censored]'
|
||||
if 'censored_strings' in bot.config:
|
||||
if bot.config['censored_strings']:
|
||||
words = map(re.escape, bot.config['censored_strings'])
|
||||
regex = re.compile('(%s)' % "|".join(words))
|
||||
text = regex.sub(replacement, text)
|
||||
|
|
Reference in a new issue