[core] Add censor filter debug messages

This commit is contained in:
Cathy Hu 2020-07-06 14:37:26 +02:00 committed by acipm
parent 2e4be2de15
commit 5bc69c8a33

View file

@ -58,10 +58,13 @@ class Censor:
async def __is_appropriate(self, message):
for badword in await BadWord.objects.filter(hood=self.hood).all():
if match(badword.pattern, message.text):
logger.debug('Matched bad word - dropped message: %s' % message.text)
return False
for trigger in await Trigger.objects.filter(hood=self.hood).all():
if match(trigger.pattern, message.text):
logger.debug('Matched trigger - passed message: %s' % message.text)
return True
logger.debug('Did not match any trigger - dropped message: %s' % message.text)
return False