From 0eadb44e20ff3fbcd861c490fb8946d1bd6aefda Mon Sep 17 00:00:00 2001 From: synodriver Date: Sat, 19 Nov 2022 08:14:03 +0000 Subject: [PATCH] =?UTF-8?q?:bug:=20Fix:=20Bot=20`=5F=5Fgetattr=5F=5F`=20?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=AF=B9=20`=5F=5Fxxx=5F=5F`=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=BF=94=E5=9B=9E=20(#1398)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot/internal/adapter/bot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonebot/internal/adapter/bot.py b/nonebot/internal/adapter/bot.py index cf1df182..8961b89f 100644 --- a/nonebot/internal/adapter/bot.py +++ b/nonebot/internal/adapter/bot.py @@ -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