From dd054f1c8b457e886efb28aae6129fd239cfdb70 Mon Sep 17 00:00:00 2001 From: evilbeast Date: Thu, 1 Sep 2022 14:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0fastapi=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi_example/mgr.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fastapi_example/mgr.py b/fastapi_example/mgr.py index 8b3af7b..a8553a4 100644 --- a/fastapi_example/mgr.py +++ b/fastapi_example/mgr.py @@ -32,6 +32,7 @@ class ClientManager(metaclass=Singleton): # 注册回调 wechat.on(ntchat.MT_ALL, self.__on_callback) + wechat.on(ntchat.MT_RECV_WECHAT_QUIT_MSG, self.__on_quit_callback) return guid def get_client(self, guid: str) -> Union[None, ntchat.WeChat]: @@ -53,3 +54,6 @@ class ClientManager(metaclass=Singleton): "message": message } requests.post(self.callback_url, json=client_message) + + def __on_quit_callback(self, wechat): + self.__on_callback(wechat, {})