mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-10-25 20:16:41 +00:00
🐛 Fix: Bot __getattr__ 不再对 __xxx__ 方法返回 (#1398)
This commit is contained in:
@@ -43,6 +43,10 @@ class Bot(abc.ABC):
|
||||
return f"Bot(type={self.type!r}, self_id={self.self_id!r})"
|
||||
|
||||
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)
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user