mirror of
https://github.com/miloszowi/everyone-mention-telegram-bot.git
synced 2025-10-24 16:05:49 +00:00
Dynamic mentioning added, removed some unwanted properties, updated README
This commit is contained in:
@@ -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.'))
|
||||
|
||||
Reference in New Issue
Block a user