Add the ability to set the option name with commands.Option

This commit is contained in:
StockerMC
2021-10-15 13:32:55 -04:00
parent e0bf2f9121
commit 8f846ba2f5
2 changed files with 9 additions and 3 deletions

View File

@@ -1039,16 +1039,18 @@ class Option(Generic[T, DT]): # type: ignore
__slots__ = (
"default",
"description",
"name",
)
def __init__(self, default: T = inspect.Parameter.empty, *, description: DT) -> None:
def __init__(self, default: T = inspect.Parameter.empty, *, description: DT, name: str = discord.utils.MISSING) -> None:
self.description = description
self.default = default
self.name: str = name
if TYPE_CHECKING:
# Terrible workaround for type checking reasons
def Option(default: T = inspect.Parameter.empty, *, description: str) -> T:
def Option(default: T = inspect.Parameter.empty, *, description: str, name: str = discord.utils.MISSING) -> T:
...