소스 검색

Merge pull request #587 from lanvent/dev2

fix: request qrscan when hotreload failed
master
zhayujie GitHub 1 년 전
부모
커밋
f805b29a8c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1개의 변경된 파일14개의 추가작업 그리고 2개의 파일을 삭제
  1. +14
    -2
      channel/wechat/wechat_channel.py

+ 14
- 2
channel/wechat/wechat_channel.py 파일 보기

@@ -4,6 +4,7 @@
wechat channel
"""

import os
import itchat
import json
from itchat.content import *
@@ -50,9 +51,20 @@ class WechatChannel(Channel):
pass

def startup(self):
# login by scan QRCode
itchat.auto_login(enableCmdQR=2, hotReload=conf().get('hot_reload', False))

itchat.instance.receivingRetryCount = 600 # 修改断线超时时间
# login by scan QRCode
hotReload = conf().get('hot_reload', False)
try:
itchat.auto_login(enableCmdQR=2, hotReload=hotReload)
except Exception as e:
if hotReload:
logger.error("Hot reload failed, try to login without hot reload")
itchat.logout()
os.remove("itchat.pkl")
itchat.auto_login(enableCmdQR=2, hotReload=hotReload)
else:
raise e
# start message listener
itchat.run()



Loading…
취소
저장