diff --git a/client/src/telethon/_impl/mtproto/mtp/types.py b/client/src/telethon/_impl/mtproto/mtp/types.py index 18578e2e..f9f78504 100644 --- a/client/src/telethon/_impl/mtproto/mtp/types.py +++ b/client/src/telethon/_impl/mtproto/mtp/types.py @@ -69,7 +69,7 @@ class RpcError(ValueError): self._code = code self._name = name self._value = value - self._caused_by = caused_by + self.caused_by: int | None = caused_by @property def code(self) -> int: @@ -96,20 +96,6 @@ class RpcError(ValueError): """ return self._value - @property - def caused_by(self) -> Optional[int]: - """ - Constructor identifier of the request that caused the error, if known. - """ - return self._caused_by - - @caused_by.setter - def caused_by(self, value: int) -> None: - """ - Constructor identifier of the request that caused the error, if known. - """ - self._caused_by = value - @classmethod def _from_mtproto_error(cls, error: GeneratedRpcError) -> Self: if m := re.search(r"-?\d+", error.error_message): @@ -172,7 +158,7 @@ class BadMessageError(ValueError): self.msg_id = msg_id self._code = code - self._caused_by = caused_by + self.caused_by: int | None = caused_by self.severity = ( logging.WARNING if self._code in NON_FATAL_MSG_IDS else logging.ERROR ) @@ -189,14 +175,6 @@ class BadMessageError(ValueError): def fatal(self) -> bool: return self._code not in NON_FATAL_MSG_IDS - @property - def caused_by(self) -> Optional[int]: - return self._caused_by - - @caused_by.setter - def caused_by(self, value: int) -> None: - self._caused_by = value - def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented