mirror of
https://github.com/miloszowi/everyone-mention-telegram-bot.git
synced 2025-05-20 09:14:07 +00:00
added more validation on group name input
This commit is contained in:
parent
a3254dee45
commit
33b66af781
@ -22,9 +22,16 @@ class UpdateData():
|
||||
chat_id = str(update.effective_chat.id)
|
||||
|
||||
if context.args and context.args[0]:
|
||||
if not context.args[0].isalpha() or context.args[0] == Group.default_name:
|
||||
raise InvalidArgumentException(re.escape(f'Group name must contain only letters and can not be `{Group.default_name}`.'))
|
||||
else:
|
||||
group_name = str(context.args[0])
|
||||
if not context.args[0].isalpha():
|
||||
raise InvalidArgumentException(re.escape('Group name must contain only letters.'))
|
||||
|
||||
if context.args[0] == Group.default_name:
|
||||
raise InvalidArgumentException(re.escape(f'Group can not be `{Group.default_name}`.'))
|
||||
|
||||
if len(context.args[0]) > 20:
|
||||
raise InvalidArgumentException(re.escape(f'Group name length can not be greater than 20.'))
|
||||
|
||||
chat_id += f'~{context.args[0]}'.lower()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user