diff --git a/discord/utils.py b/discord/utils.py index bd29caabc..072293124 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -155,6 +155,15 @@ class CachedSlotProperty(Generic[T, T_co]): setattr(instance, self.name, value) return value +class classproperty(Generic[T_co]): + def __init__(self, fget: Callable[[Any], T_co]) -> None: + self.fget = fget + + def __get__(self, instance: Optional[Any], owner: Type[Any]) -> T_co: + return self.fget(owner) + + def __set__(self, instance, value) -> None: + raise AttributeError('cannot set attribute') def cached_slot_property(name: str) -> Callable[[Callable[[T], T_co]], CachedSlotProperty[T, T_co]]: def decorator(func: Callable[[T], T_co]) -> CachedSlotProperty[T, T_co]: