mirror of
https://github.com/zhayujie/bot-on-anything.git
synced 2026-01-19 09:41:07 +08:00
feat: 增加支持将登录二维码开放出来的功能
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
},
|
||||
|
||||
"wechat": {
|
||||
"receive_qrcode_api": ""
|
||||
},
|
||||
|
||||
"wechat_mp": {
|
||||
|
||||
Reference in New Issue
Block a user