From 50078087e591a08de1ceac2ea2153b5b7cbb2849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20N=C3=B8rgaard?= Date: Mon, 21 Nov 2022 06:15:18 +0000 Subject: [PATCH] [commands] Fix variance issues in Bot.add_cog with List[Snowflake] --- discord/ext/commands/bot.py | 5 +++-- discord/ext/commands/cog.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 9e1fc88e6..363b6656c 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -41,6 +41,7 @@ from typing import ( Dict, TYPE_CHECKING, Optional, + Sequence, TypeVar, Type, Union, @@ -703,7 +704,7 @@ class BotBase(GroupMixin[None]): *, override: bool = False, guild: Optional[Snowflake] = MISSING, - guilds: List[Snowflake] = MISSING, + guilds: Sequence[Snowflake] = MISSING, ) -> None: """|coro| @@ -811,7 +812,7 @@ class BotBase(GroupMixin[None]): /, *, guild: Optional[Snowflake] = MISSING, - guilds: List[Snowflake] = MISSING, + guilds: Sequence[Snowflake] = MISSING, ) -> Optional[Cog]: """|coro| diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 31c540619..ac48d2df3 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -39,6 +39,7 @@ from typing import ( List, Optional, TYPE_CHECKING, + Sequence, Tuple, TypeVar, Union, @@ -660,7 +661,7 @@ class Cog(metaclass=CogMeta): """ pass - async def _inject(self, bot: BotBase, override: bool, guild: Optional[Snowflake], guilds: List[Snowflake]) -> Self: + async def _inject(self, bot: BotBase, override: bool, guild: Optional[Snowflake], guilds: Sequence[Snowflake]) -> Self: cls = self.__class__ # we'll call this first so that errors can propagate without