Dynamic mentioning added, removed some unwanted properties, updated README

This commit is contained in:
miloszowi
2021-11-12 12:23:54 +01:00
parent f9643f052e
commit 6790426ba2
10 changed files with 99 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ from exception.invalidArgumentException import InvalidArgumentException
class GroupNameValidator:
MAX_GROUP_NAME_LENGTH: int = 40
FORBIDDEN_GROUP_NAMES = ['all', 'channel', 'chat', 'everyone', 'group', 'here']
@staticmethod
def validate(group: str) -> None:
@@ -15,3 +16,6 @@ class GroupNameValidator:
if len(group) > GroupNameValidator.MAX_GROUP_NAME_LENGTH:
raise InvalidArgumentException(re.escape(f'Group name length can not be greater than {GroupNameValidator.MAX_GROUP_NAME_LENGTH}.'))
if group in GroupNameValidator.FORBIDDEN_GROUP_NAMES:
raise InvalidArgumentException(re.escape(f'This group name is forbidden, please try with other name.'))