Browse Source

Fix typing of guilds kwargs to take Sequence instead of List

pull/7946/head
Rapptz 3 years ago
parent
commit
ab64a2eae9
  1. 9
      discord/app_commands/tree.py

9
discord/app_commands/tree.py

@ -38,6 +38,7 @@ from typing import (
List, List,
Literal, Literal,
Optional, Optional,
Sequence,
Set, Set,
Tuple, Tuple,
TypeVar, TypeVar,
@ -84,7 +85,7 @@ APP_ID_NOT_FOUND = (
def _retrieve_guild_ids( def _retrieve_guild_ids(
command: Any, guild: Optional[Snowflake] = MISSING, guilds: List[Snowflake] = MISSING command: Any, guild: Optional[Snowflake] = MISSING, guilds: Sequence[Snowflake] = MISSING
) -> Optional[Set[int]]: ) -> Optional[Set[int]]:
if guild is not MISSING and guilds is not MISSING: if guild is not MISSING and guilds is not MISSING:
raise TypeError('cannot mix guild and guilds keyword arguments') raise TypeError('cannot mix guild and guilds keyword arguments')
@ -226,7 +227,7 @@ class CommandTree(Generic[ClientT]):
/, /,
*, *,
guild: Optional[Snowflake] = MISSING, guild: Optional[Snowflake] = MISSING,
guilds: List[Snowflake] = MISSING, guilds: Sequence[Snowflake] = MISSING,
override: bool = False, override: bool = False,
) -> None: ) -> None:
"""Adds an application command to the tree. """Adds an application command to the tree.
@ -786,7 +787,7 @@ class CommandTree(Generic[ClientT]):
name: str = MISSING, name: str = MISSING,
description: str = MISSING, description: str = MISSING,
guild: Optional[Snowflake] = MISSING, guild: Optional[Snowflake] = MISSING,
guilds: List[Snowflake] = MISSING, guilds: Sequence[Snowflake] = MISSING,
) -> Callable[[CommandCallback[Group, P, T]], Command[Group, P, T]]: ) -> Callable[[CommandCallback[Group, P, T]], Command[Group, P, T]]:
"""Creates an application command directly under this tree. """Creates an application command directly under this tree.
@ -836,7 +837,7 @@ class CommandTree(Generic[ClientT]):
*, *,
name: str = MISSING, name: str = MISSING,
guild: Optional[Snowflake] = MISSING, guild: Optional[Snowflake] = MISSING,
guilds: List[Snowflake] = MISSING, guilds: Sequence[Snowflake] = MISSING,
) -> Callable[[ContextMenuCallback], ContextMenu]: ) -> Callable[[ContextMenuCallback], ContextMenu]:
"""Creates a application command context menu from a regular function directly under this tree. """Creates a application command context menu from a regular function directly under this tree.

Loading…
Cancel
Save