mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Change lowercase detection to work with CJK languages
str.islower() does not properly work with characters in the Lo category so CJK languages fail the check. Fix #7698
This commit is contained in:
parent
fd5dea4e34
commit
446c502995
@ -142,7 +142,12 @@ def validate_name(name: str) -> str:
|
||||
match = VALID_SLASH_COMMAND_NAME.match(name)
|
||||
if match is None:
|
||||
raise ValueError('names must be between 1-32 characters')
|
||||
if not name.islower():
|
||||
|
||||
# Ideally, name.islower() would work instead but since certain characters
|
||||
# are Lo (e.g. CJK) those don't pass the test. I'd use `casefold` instead as
|
||||
# well, but chances are the server-side check is probably something similar to
|
||||
# this code anyway.
|
||||
if name.lower() != name:
|
||||
raise ValueError('names must be all lower case')
|
||||
return name
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user