fix: temporarily close the wx channel to prevent account ban

This commit is contained in:
Saboteur7
2025-01-17 17:24:42 +08:00
parent 83ea7352b9
commit aa300a4c98
3 changed files with 29 additions and 19 deletions

View File

@@ -3,5 +3,5 @@
#使用方法 #使用方法
- 在配置文件中channel_type填入web即可 - 在配置文件中channel_type填入web即可
- 访问地址 http://localhost:9899 - 访问地址 http://localhost:9899/chat
- port可以在配置项 web_port中设置 - port可以在配置项 web_port中设置

View File

@@ -177,7 +177,7 @@ class WebChannel(ChatChannel):
def startup(self): def startup(self):
logger.setLevel("WARN") logger.setLevel("WARN")
print("\nWeb Channel is running. Send POST requests to /message to send messages.") print("\nWeb Channel is running, please visit http://localhost:9899/chat")
urls = ( urls = (
'/sse/(.+)', 'SSEHandler', # 修改路由以接收用户ID '/sse/(.+)', 'SSEHandler', # 修改路由以接收用户ID

View File

@@ -117,23 +117,33 @@ class WechatChannel(ChatChannel):
def startup(self): def startup(self):
try: try:
itchat.instance.receivingRetryCount = 600 # 修改断线超时时间 time.sleep(3)
# login by scan QRCode logger.error("""[WechatChannel] 当前channel暂不可用目前支持的channel有:
hotReload = conf().get("hot_reload", False) 1. terminal: 终端
status_path = os.path.join(get_appdata_dir(), "itchat.pkl") 2. wechatmp: 个人公众号
itchat.auto_login( 3. wechatmp_service: 企业公众号
enableCmdQR=2, 4. wechatcom_app: 企微自建应用
hotReload=hotReload, 5. dingtalk: 钉钉
statusStorageDir=status_path, 6. feishu: 飞书
qrCallback=qrCallback, 7. web: 网页
exitCallback=self.exitCallback, 可修改 config.json 配置文件的 channel_type 字段进行切换""")
loginCallback=self.loginCallback # itchat.instance.receivingRetryCount = 600 # 修改断线超时时间
) # # login by scan QRCode
self.user_id = itchat.instance.storageClass.userName # hotReload = conf().get("hot_reload", False)
self.name = itchat.instance.storageClass.nickName # status_path = os.path.join(get_appdata_dir(), "itchat.pkl")
logger.info("Wechat login success, user_id: {}, nickname: {}".format(self.user_id, self.name)) # itchat.auto_login(
# start message listener # enableCmdQR=2,
itchat.run() # hotReload=hotReload,
# statusStorageDir=status_path,
# qrCallback=qrCallback,
# exitCallback=self.exitCallback,
# loginCallback=self.loginCallback
# )
# self.user_id = itchat.instance.storageClass.userName
# self.name = itchat.instance.storageClass.nickName
# logger.info("Wechat login success, user_id: {}, nickname: {}".format(self.user_id, self.name))
# # start message listener
# itchat.run()
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)