Add member name conflict warning. Closes #10.

This commit is contained in:
Ske
2018-11-30 21:51:57 +01:00
parent c36a054519
commit 728c8ee8d0
6 changed files with 25 additions and 6 deletions

View File

@@ -10,9 +10,11 @@ from pluralkit.member import Member
logger = logging.getLogger("pluralkit.utils")
def escape(s):
return s.replace("`", "\\`")
def bounds_check_member_name(new_name, system_tag):
if len(new_name) > 32:
return "Name cannot be longer than 32 characters."
@@ -21,6 +23,7 @@ def bounds_check_member_name(new_name, system_tag):
if len("{} {}".format(new_name, system_tag)) > 32:
return "This name, combined with the system tag ({}), would exceed the maximum length of 32 characters. Please reduce the length of the tag, or use a shorter name.".format(system_tag)
async def parse_mention(client: discord.Client, mention: str) -> Optional[discord.User]:
# First try matching mention format
match = re.fullmatch("<@!?(\\d+)>", mention)