make metaclass not generic

This commit is contained in:
Zomatree
2022-09-26 01:26:03 +01:00
parent bf8ded7588
commit 23354d030b
+4 -4
View File
@@ -34,11 +34,11 @@ class ExtensionProtocol(Protocol):
def setup(client: CommandsClient) -> None:
raise NotImplementedError
class CommandsMeta(type, Generic[ClientT]):
_commands: list[Command[ClientT]]
class CommandsMeta(type):
_commands: list[Command[Any]]
def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]):
commands: list[Command[ClientT]] = []
commands: list[Command[Any]] = []
self = super().__new__(cls, name, bases, attrs)
for base in reversed(self.__mro__):
for value in base.__dict__.values():
@@ -75,7 +75,7 @@ class CaseInsensitiveDict(dict[str, V]):
super().__delitem__(key.casefold())
class CommandsClient(revolt.Client, metaclass=CommandsMeta[Self]):
class CommandsClient(revolt.Client, metaclass=CommandsMeta):
"""Main class that adds commands, this class should be subclassed along with `revolt.Client`."""
_commands: list[Command[Self]]