mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 08:40:11 +00:00
Add member name conflict warning. Closes #10.
This commit is contained in:
parent
c36a054519
commit
728c8ee8d0
6 changed files with 25 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue