mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-03 08:35:53 +00:00
Use Unpack where it's possible
This commit is contained in:
@ -44,18 +44,30 @@ from typing import (
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
TypedDict,
|
||||
)
|
||||
|
||||
from ._types import _BaseCommand, BotT
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
from typing_extensions import Self, Unpack
|
||||
from discord.abc import Snowflake
|
||||
from discord._types import ClientT
|
||||
|
||||
from .bot import BotBase
|
||||
from .context import Context
|
||||
from .core import Command
|
||||
from .core import Command, _CommandDecoratorKwargs
|
||||
|
||||
class _CogKwargs(TypedDict, total=False):
|
||||
name: str
|
||||
group_name: Union[str, app_commands.locale_str]
|
||||
description: str
|
||||
group_description: Union[str, app_commands.locale_str]
|
||||
group_nsfw: bool
|
||||
group_auto_locale_strings: bool
|
||||
group_extras: Dict[Any, Any]
|
||||
command_attrs: _CommandDecoratorKwargs
|
||||
|
||||
|
||||
__all__ = (
|
||||
'CogMeta',
|
||||
@ -169,7 +181,7 @@ class CogMeta(type):
|
||||
__cog_app_commands__: List[Union[app_commands.Group, app_commands.Command[Any, ..., Any]]]
|
||||
__cog_listeners__: List[Tuple[str, str]]
|
||||
|
||||
def __new__(cls, *args: Any, **kwargs: Any) -> CogMeta:
|
||||
def __new__(cls, *args: Any, **kwargs: Unpack[_CogKwargs]) -> CogMeta:
|
||||
name, bases, attrs = args
|
||||
if any(issubclass(base, app_commands.Group) for base in bases):
|
||||
raise TypeError(
|
||||
|
Reference in New Issue
Block a user