1.1.6 Улучшен валидатор username и добавлен валидатор нормального вида слов
This commit is contained in:
@@ -5,3 +5,4 @@
|
||||
from .email_valid import *
|
||||
from .username import *
|
||||
from .url_valid import *
|
||||
from .normal_word import *
|
||||
|
||||
5
BotLibrary/validators/normal_word.py
Normal file
5
BotLibrary/validators/normal_word.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# BotLibrary/validators/normal_word.py
|
||||
# Нормализирует вид слова автоматически
|
||||
|
||||
async def normal_words(word : str = "Тестовое слово") -> str:
|
||||
return word.lower().capitalize()
|
||||
@@ -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 отсутствует
|
||||
|
||||
Reference in New Issue
Block a user