format Black
This commit is contained in:
+12
-7
@@ -2,7 +2,7 @@ from .config import *
|
||||
|
||||
|
||||
def in_spam_list(message: types.Message) -> bool:
|
||||
""" Check for mentioning unwanted persons in text. """
|
||||
"""Check for mentioning unwanted persons in text."""
|
||||
if message.from_user.id not in WHITEIDS:
|
||||
for url in SPAM:
|
||||
if url in message.text.casefold():
|
||||
@@ -10,7 +10,7 @@ def in_spam_list(message: types.Message) -> bool:
|
||||
|
||||
|
||||
def in_caption_spam_list(type_message: types.Message) -> bool:
|
||||
""" Check for mentioning unwanted words in caption. """
|
||||
"""Check for mentioning unwanted words in caption."""
|
||||
for phrase in BAN_WORDS:
|
||||
if type_message.caption and phrase in type_message.caption:
|
||||
return True
|
||||
@@ -24,21 +24,26 @@ def in_not_allowed(word_list, msg):
|
||||
|
||||
|
||||
def in_delete_list(type_message: types.Message) -> bool:
|
||||
""" Check for URLs in message and delete. """
|
||||
"""Check for URLs in message and delete."""
|
||||
if type_message.from_user.id not in WHITEIDS:
|
||||
if URL_RX.search(type_message.text) and in_not_allowed(ALLOWED_WORDS, type_message.text):
|
||||
logging.info(f'[DEL] {type_message.from_user.id} {type_message.from_user.first_name} - {type_message.text}')
|
||||
if URL_RX.search(type_message.text) and in_not_allowed(
|
||||
ALLOWED_WORDS, type_message.text
|
||||
):
|
||||
logging.info(
|
||||
f"[DEL] {type_message.from_user.id} {type_message.from_user.first_name} - {type_message.text}"
|
||||
)
|
||||
return True
|
||||
if type_message.entities:
|
||||
for entity in type_message.entities:
|
||||
if entity.url and in_not_allowed(ALLOWED_WORDS, entity.url):
|
||||
logging.info(
|
||||
f'[DEL] {type_message.from_user.id} {type_message.from_user.first_name} - Entity ({entity.url})')
|
||||
f"[DEL] {type_message.from_user.id} {type_message.from_user.first_name} - Entity ({entity.url})"
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
def is_nongrata(type_message: types.Message) -> bool:
|
||||
""" Check for non grata persons. """
|
||||
"""Check for non grata persons."""
|
||||
for phrase in NON_GRATA:
|
||||
if phrase in type_message.text.casefold():
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user