new regex for username
This commit is contained in:
parent
9ba8fa5cd2
commit
b99a1247d2
@ -58,7 +58,7 @@ def start_name_setter(message):
|
|||||||
if str(message.text).lower() == "cancel": # Set user name to user
|
if str(message.text).lower() == "cancel": # Set user name to user
|
||||||
user_name = "User" + str(user_id) # generate user name, user can change it with /changename
|
user_name = "User" + str(user_id) # generate user name, user can change it with /changename
|
||||||
|
|
||||||
if not re.match(r'^[a-zA-Z][a-zA-Z0-9_]+$', str(message.text)):
|
if not re.match(r'^[a-zA-Z][a-zA-Z0-9_\-]+$', str(message.text)):
|
||||||
bot.reply_to(message, "Name has to be alphanumeric (including underscores) and start with a letter")
|
bot.reply_to(message, "Name has to be alphanumeric (including underscores) and start with a letter")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ def change_name_setter(message):
|
|||||||
bot.reply_to(message, "Name not changed")
|
bot.reply_to(message, "Name not changed")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not re.match(r'^[a-zA-Z][a-zA-Z0-9_]+$', str(message.text)):
|
if not re.match(r'^[a-zA-Z][a-zA-Z0-9_\-]+$', str(message.text)):
|
||||||
bot.reply_to(message, "Name has to be alphanumeric (including underscores) and start with a letter")
|
bot.reply_to(message, "Name has to be alphanumeric (including underscores) and start with a letter")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user