mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +08:00
🐛 Fix: Bot __getattr__
不再对 __xxx__
方法返回 (#1398)
This commit is contained in:
parent
6b43209d37
commit
0eadb44e20
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user