feat: 增加支持将登录二维码开放出来的功能

This commit is contained in:
牟勇
2023-03-18 13:00:10 +08:00
parent 04f1399b03
commit 1aa002b8f2
2 changed files with 9 additions and 1 deletions

View File

@@ -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))

View File

@@ -28,6 +28,7 @@
},
"wechat": {
"receive_qrcode_api": ""
},
"wechat_mp": {