refactor bot.py

This commit is contained in:
Rykov7
2022-12-20 05:16:08 +03:00
parent a12b9ea0b3
commit 498b71e166
3 changed files with 15 additions and 24 deletions
+2 -4
View File
@@ -1,4 +1,3 @@
import logging
from telebot import types
from .config import *
@@ -13,8 +12,7 @@ def check_spam_list(type_message: types.Message) -> bool:
def check_caption_spam_list(type_message: types.Message) -> bool:
""" Check for mentioning unwanted words in caption. """
unwanted_phrases = ['GREEN ROOM']
for phrase in unwanted_phrases:
for phrase in BAN_WORDS:
if type_message.caption and phrase in type_message.caption:
return True
@@ -41,7 +39,7 @@ def check_delete_list(type_message: types.Message) -> bool:
def check_nongrata(type_message: types.Message) -> bool:
""" Check for bloggers. """
""" Check for non grata persons. """
for phrase in NON_GRATA:
if phrase in type_message.text.casefold():
return True