diff --git a/BotLibrary/validators/__init__.py b/BotLibrary/validators/__init__.py index a45718c..2fde490 100644 --- a/BotLibrary/validators/__init__.py +++ b/BotLibrary/validators/__init__.py @@ -5,3 +5,4 @@ from .email_valid import * from .username import * from .url_valid import * +from .normal_word import * diff --git a/BotLibrary/validators/normal_word.py b/BotLibrary/validators/normal_word.py new file mode 100644 index 0000000..7c8c2bc --- /dev/null +++ b/BotLibrary/validators/normal_word.py @@ -0,0 +1,5 @@ +# BotLibrary/validators/normal_word.py +# Нормализирует вид слова автоматически + +async def normal_words(word : str = "Тестовое слово") -> str: + return word.lower().capitalize() diff --git a/BotLibrary/validators/username.py b/BotLibrary/validators/username.py index 35c8da7..47faf8a 100644 --- a/BotLibrary/validators/username.py +++ b/BotLibrary/validators/username.py @@ -15,5 +15,5 @@ def username(message: Message) -> str: :return: Строка с юзернеймом пользователя или его ID. """ if message.from_user: - return f"@{message.from_user.username}" if message.from_user.username else str(message.from_user.id) + return f"@{message.from_user.username}" if message.from_user.username else f"@{message.from_user.id}" return "@Unknown_User" # Если from_user отсутствует