From 1aa002b8f206f215dd6635ff1e58cf0e4f0f089c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=89=9F=E5=8B=87?= Date: Sat, 18 Mar 2023 13:00:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=B0=86=E7=99=BB=E5=BD=95=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=BC=80?= =?UTF-8?q?=E6=94=BE=E5=87=BA=E6=9D=A5=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/wechat/wechat_channel.py | 9 ++++++++- config-template.json | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index f4a5585..8a9fdba 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -40,11 +40,18 @@ class WechatChannel(Channel): def startup(self): # login by scan QRCode - itchat.auto_login(enableCmdQR=2, hotReload=True) + if (channel_conf_val(const.WECHAT, 'receive_qrcode_api')): + itchat.auto_login(enableCmdQR=2, hotReload=False, qrCallback=self.login) + else: + itchat.auto_login(enableCmdQR=2, hotReload=False) # start message listener itchat.run() + def login(self, uuid=None, status='0', qrcode=None): + print('uuid:', uuid) + print('status:', status) + print('qrcode_link:', 'https://login.weixin.qq.com/l/'+uuid) def handle(self, msg): logger.debug("[WX]receive msg: " + json.dumps(msg, ensure_ascii=False)) diff --git a/config-template.json b/config-template.json index f1088e2..f678c57 100644 --- a/config-template.json +++ b/config-template.json @@ -28,6 +28,7 @@ }, "wechat": { + "receive_qrcode_api": "" }, "wechat_mp": {