From a1f7647ba80cac7abe7bbe17f8999404af5b8a9c Mon Sep 17 00:00:00 2001 From: Verum Date: Tue, 25 Feb 2025 16:59:25 +0700 Subject: [PATCH] =?UTF-8?q?1.1.6=20=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=82=D0=BE=D1=80?= =?UTF-8?q?=20username=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D0=B0=D0=BB=D0=B8=D0=B4=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=20=D0=BD=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B2=D0=B8=D0=B4=D0=B0=20=D1=81=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BotLibrary/validators/__init__.py | 1 + BotLibrary/validators/normal_word.py | 5 +++++ BotLibrary/validators/username.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 BotLibrary/validators/normal_word.py 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 отсутствует