mirror of
https://github.com/miloszowi/everyone-mention-telegram-bot.git
synced 2025-10-24 16:05:49 +00:00
Added inline query handler, updated CHANGELOG, added group name validator
This commit is contained in:
16
src/validator/groupNameValidator.py
Normal file
16
src/validator/groupNameValidator.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import re
|
||||
|
||||
from exception.invalidArgumentException import InvalidArgumentException
|
||||
|
||||
|
||||
class GroupNameValidator:
|
||||
|
||||
@staticmethod
|
||||
def validate(group: str) -> None:
|
||||
group = group.lower()
|
||||
|
||||
if len(group) > 0 and not re.match(r"^[A-Za-z]+$", group):
|
||||
raise InvalidArgumentException(re.escape('Group name must contain only letters.'))
|
||||
|
||||
if len(group) > 20:
|
||||
raise InvalidArgumentException(re.escape(f'Group name length can not be greater than 20.'))
|
||||
Reference in New Issue
Block a user