🐛 Fix: Bot __getattr__ 不再对 __xxx__ 方法返回 (#1398)

This commit is contained in:
synodriver 2022-11-19 08:14:03 +00:00 committed by GitHub
parent 6b43209d37
commit 0eadb44e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,10 @@ class Bot(abc.ABC):
return f"Bot(type={self.type!r}, self_id={self.self_id!r})" return f"Bot(type={self.type!r}, self_id={self.self_id!r})"
def __getattr__(self, name: str) -> "_ApiCall": def __getattr__(self, name: str) -> "_ApiCall":
if name.startswith("__") and name.endswith("__"):
raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{name}'"
)
return partial(self.call_api, name) return partial(self.call_api, name)
@property @property