Add ban words

This commit is contained in:
Rykov7
2023-09-02 20:12:33 +03:00
parent b83ccfab85
commit 9e4d2d1bd7
3 changed files with 81 additions and 76 deletions
+5
View File
@@ -1,3 +1,5 @@
import logging.handlers
from .models import session
from .models import Chat
from .config import *
@@ -6,8 +8,11 @@ from .config import *
def in_spam_list(message: types.Message) -> bool:
"""Check for mentioning unwanted persons in text."""
antispam_is_enabled = session.query(Chat.antispam).filter_by(chat_id=message.chat.id).first()[0]
logging.critical(str(antispam_is_enabled))
if message.from_user.id not in WHITEIDS and antispam_is_enabled:
logging.critical('if message.from_user.id not in WHITEIDS and antispam_is_enabled: TRUE')
for text in SPAM:
logging.critical(str(text.casefold()) + ' in ' + str(message.text.casefold()))
if text.casefold() in message.text.casefold():
logging.info(
"!BAN!" + LOG_COMM % (