fix(commands/utils): fix partial exact matching

play & playing
This commit is contained in:
Ryan 2025-01-05 16:48:46 -05:00
parent 6930f964c5
commit 116ed896ab
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -25,6 +25,14 @@ def match_token(token: str) -> list[Command]:
if token.lower() == "r": if token.lower() == "r":
return [Command.RELOAD] return [Command.RELOAD]
if exact_match := list(
filter(
lambda command: command.value == token.lower(),
Command.__members__.values(),
)
):
return exact_match
return list( return list(
filter( filter(
lambda command: command.value.startswith(token.lower()), lambda command: command.value.startswith(token.lower()),