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