Skip to content

Commit 58ca91d

Browse files
committed
Update kwarg typing to be Never to discourage random kwarg passing
1 parent 8ab304c commit 58ca91d

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

discord/bot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
from .utils import MISSING, async_all, find, get
6767

6868
if TYPE_CHECKING:
69+
from typing_extensions import Never
70+
6971
from .cog import Cog
7072
from .commands import Option
7173
from .ext.commands import Cooldown
@@ -930,7 +932,7 @@ def slash_command(
930932
nsfw: bool = False,
931933
options: list[Option] | None = MISSING,
932934
parent: SlashCommandGroup | None = MISSING,
933-
**kwargs: Any,
935+
**kwargs: Never,
934936
) -> Callable[[...], SlashCommand]:
935937
"""A shortcut decorator for adding a slash command to the bot.
936938
This is equivalent to using :meth:`application_command`, providing
@@ -976,7 +978,7 @@ def user_command(
976978
name: str | None = MISSING,
977979
name_localizations: dict[str, str] | None = MISSING,
978980
nsfw: bool = False,
979-
**kwargs: Any,
981+
**kwargs: Never,
980982
) -> Callable[..., UserCommand]:
981983
"""A shortcut decorator for adding a user command to the bot.
982984
This is equivalent to using :meth:`application_command`, providing
@@ -1018,7 +1020,7 @@ def message_command(
10181020
name: str | None = MISSING,
10191021
name_localizations: dict[str, str] | None = MISSING,
10201022
nsfw: bool = False,
1021-
**kwargs: Any,
1023+
**kwargs: Never,
10221024
) -> Callable[..., MessageCommand]:
10231025
"""A shortcut decorator for adding a message command to the bot.
10241026
This is equivalent to using :meth:`application_command`, providing
@@ -1065,7 +1067,7 @@ def application_command(
10651067
nsfw: bool = False,
10661068
options: list[Option] | None = MISSING,
10671069
parent: SlashCommandGroup | None = MISSING,
1068-
**kwargs: Any,
1070+
**kwargs: Never,
10691071
) -> Callable[..., C]:
10701072
"""A shortcut decorator that converts the provided function into
10711073
an application command via :func:`command` and adds it to

discord/commands/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
)
9191

9292
if TYPE_CHECKING:
93-
from typing_extensions import Concatenate, ParamSpec
93+
from typing_extensions import Concatenate, Never, ParamSpec
9494

9595
from .. import Permissions
9696
from ..bot import C
@@ -1995,7 +1995,7 @@ def slash_command(
19951995
nsfw: bool = False,
19961996
options: list[Option] | None = MISSING,
19971997
parent: SlashCommandGroup | None = MISSING,
1998-
**kwargs: Any,
1998+
**kwargs: Never,
19991999
) -> Callable[[...], SlashCommand]:
20002000
"""Decorator for slash commands that invokes :func:`application_command`.
20012001
@@ -2038,7 +2038,7 @@ def user_command(
20382038
name: str | None = MISSING,
20392039
name_localizations: dict[str, str] | None = MISSING,
20402040
nsfw: bool = False,
2041-
**kwargs: Any,
2041+
**kwargs: Never,
20422042
) -> Callable[..., UserCommand]:
20432043
"""Decorator for user commands that invokes :func:`application_command`.
20442044
@@ -2077,7 +2077,7 @@ def message_command(
20772077
name: str | None = MISSING,
20782078
name_localizations: dict[str, str] | None = MISSING,
20792079
nsfw: bool = False,
2080-
**kwargs: Any,
2080+
**kwargs: Never,
20812081
) -> Callable[..., MessageCommand]:
20822082
"""Decorator for message commands that invokes :func:`application_command`.
20832083
@@ -2121,7 +2121,7 @@ def application_command(
21212121
nsfw: bool = False,
21222122
options: list[Option] | None = MISSING,
21232123
parent: SlashCommandGroup | None = MISSING,
2124-
**kwargs: Any,
2124+
**kwargs: Never,
21252125
) -> Callable[..., C]:
21262126
"""A decorator that transforms a function into an :class:`.ApplicationCommand`. More specifically,
21272127
usually one of :class:`.SlashCommand`, :class:`.UserCommand`, or :class:`.MessageCommand`. The exact class

0 commit comments

Comments
 (0)