Browse Source

Only verify if context menus pass a length check

According to Discord this is the check that is actually done
pull/7784/head
Rapptz 3 years ago
parent
commit
0a7eb6b021
  1. 3
      discord/app_commands/commands.py

3
discord/app_commands/commands.py

@ -126,7 +126,6 @@ else:
CheckInputParameter = Union['Command[Any, ..., Any]', 'ContextMenu', CommandCallback, ContextMenuCallback]
VALID_SLASH_COMMAND_NAME = re.compile(r'^[\w-]{1,32}$')
VALID_CONTEXT_MENU_NAME = re.compile(r'^[?!\w\s-]{1,32}$')
CAMEL_CASE_REGEX = re.compile(r'(?<!^)(?=[A-Z])')
@ -157,7 +156,7 @@ def validate_name(name: str) -> str:
def validate_context_menu_name(name: str) -> str:
if VALID_CONTEXT_MENU_NAME.match(name) is None:
if not name or len(name) > 32:
raise ValueError('context menu names must be between 1-32 characters')
return name

Loading…
Cancel
Save