Skip to content

Commit 97a8303

Browse files
committed
🏷️ Type stuff
1 parent a611d75 commit 97a8303

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

discord/cog.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,18 @@
3131
import pathlib
3232
import sys
3333
import types
34-
from typing import Any, Callable, ClassVar, Generator, Mapping, TypeVar, overload
34+
from typing import (
35+
TYPE_CHECKING,
36+
Any,
37+
Callable,
38+
ClassVar,
39+
Generator,
40+
Mapping,
41+
TypeVar,
42+
overload,
43+
)
44+
45+
from typing_extensions import TypeGuard
3546

3647
import discord.utils
3748

@@ -43,6 +54,11 @@
4354
_BaseCommand,
4455
)
4556

57+
if TYPE_CHECKING:
58+
from .ext.bridge import BridgeCommand, BridgeCommandGroup
59+
from .ext.commands import Command
60+
61+
4662
__all__ = (
4763
"CogMeta",
4864
"Cog",
@@ -127,7 +143,11 @@ async def bar(self, ctx):
127143

128144
__cog_name__: str
129145
__cog_settings__: dict[str, Any]
130-
__cog_commands__: list[ApplicationCommand]
146+
__cog_commands__: list[
147+
ApplicationCommand # pyright: ignore[reportMissingTypeArgument]
148+
| Command # pyright: ignore[reportMissingTypeArgument]
149+
| BridgeCommand
150+
]
131151
__cog_listeners__: list[tuple[str, str]]
132152
__cog_guild_ids__: list[int]
133153

discord/commands/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ class SlashCommand(ApplicationCommand):
726726

727727
type = 1
728728

729+
parent: SlashCommandGroup | None
730+
729731
def __new__(cls, *args, **kwargs) -> SlashCommand:
730732
self = super().__new__(cls)
731733

0 commit comments

Comments
 (0)