diff --git a/src/pycord_rest/app.py b/src/pycord_rest/app.py index 16dffc2..8fc0ecd 100644 --- a/src/pycord_rest/app.py +++ b/src/pycord_rest/app.py @@ -1,6 +1,7 @@ # Copyright (c) Paillat-dev # SPDX-License-Identifier: MIT +import functools import logging from collections.abc import Callable, Coroutine from functools import cached_property @@ -42,6 +43,15 @@ class InvalidCredentialsError(PycordRestError): pass +def not_supported[T, U](func: Callable[[T], U]) -> Callable[[T], U]: + @functools.wraps(func) + def inner(*args: T, **kwargs: T) -> U: + logger.warning(f"{func.__qualname__} is not supported by REST apps.") + return func(*args, **kwargs) + + return inner + + class App(discord.Bot): def __init__(self, *args: Any, **options: Any) -> None: # pyright: ignore [reportExplicitAny] super().__init__(*args, **options) # pyright: ignore [reportUnknownMemberType] @@ -49,6 +59,12 @@ class App(discord.Bot): self.router: APIRouter = APIRouter() self._public_key: str | None = None + @property + @override + @not_supported + def latency(self) -> float: + return 0.0 + @cached_property def _verify_key(self) -> VerifyKey: if self._public_key is None: