This commit is contained in:
harold 2025-05-05 17:02:20 +05:00
parent 55c2ab61d0
commit 7f59b35d62

View File

@ -7,13 +7,21 @@ from src.core.database import TgMessage, User, TgChat
def check_message_condition(
message: Message,
) -> bool:
conditions = (
message.chat.type not in [ChatType.PRIVATE, ChatType.BOT],
bool(message.from_user),
bool(message.text),
bool('bot' not in message.from_user.username.lower() if message.from_user.username else True),
)
return all(conditions)
if message.chat.type in [ChatType.PRIVATE, ChatType.BOT]:
return False
if not message.from_user:
return False
if not message.text:
return False
if message.from_user.username:
if 'bot' in message.from_user.username.lower():
return False
return True
def create_and_format_message(