Skip to content

Commit aa300a4

Browse files
committed
fix: temporarily close the wx channel to prevent account ban
1 parent 83ea735 commit aa300a4

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

channel/web/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

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

channel/web/web_channel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def chat_page(self):
177177

178178
def startup(self):
179179
logger.setLevel("WARN")
180-
print("\nWeb Channel is running. Send POST requests to /message to send messages.")
180+
print("\nWeb Channel is running, please visit http://localhost:9899/chat")
181181

182182
urls = (
183183
'/sse/(.+)', 'SSEHandler', # 修改路由以接收用户ID

channel/wechat/wechat_channel.py

+27-17
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,33 @@ def __init__(self):
117117

118118
def startup(self):
119119
try:
120-
itchat.instance.receivingRetryCount = 600 # 修改断线超时时间
121-
# login by scan QRCode
122-
hotReload = conf().get("hot_reload", False)
123-
status_path = os.path.join(get_appdata_dir(), "itchat.pkl")
124-
itchat.auto_login(
125-
enableCmdQR=2,
126-
hotReload=hotReload,
127-
statusStorageDir=status_path,
128-
qrCallback=qrCallback,
129-
exitCallback=self.exitCallback,
130-
loginCallback=self.loginCallback
131-
)
132-
self.user_id = itchat.instance.storageClass.userName
133-
self.name = itchat.instance.storageClass.nickName
134-
logger.info("Wechat login success, user_id: {}, nickname: {}".format(self.user_id, self.name))
135-
# start message listener
136-
itchat.run()
120+
time.sleep(3)
121+
logger.error("""[WechatChannel] 当前channel暂不可用,目前支持的channel有:
122+
1. terminal: 终端
123+
2. wechatmp: 个人公众号
124+
3. wechatmp_service: 企业公众号
125+
4. wechatcom_app: 企微自建应用
126+
5. dingtalk: 钉钉
127+
6. feishu: 飞书
128+
7. web: 网页
129+
可修改 config.json 配置文件的 channel_type 字段进行切换""")
130+
# itchat.instance.receivingRetryCount = 600 # 修改断线超时时间
131+
# # login by scan QRCode
132+
# hotReload = conf().get("hot_reload", False)
133+
# status_path = os.path.join(get_appdata_dir(), "itchat.pkl")
134+
# itchat.auto_login(
135+
# enableCmdQR=2,
136+
# hotReload=hotReload,
137+
# statusStorageDir=status_path,
138+
# qrCallback=qrCallback,
139+
# exitCallback=self.exitCallback,
140+
# loginCallback=self.loginCallback
141+
# )
142+
# self.user_id = itchat.instance.storageClass.userName
143+
# self.name = itchat.instance.storageClass.nickName
144+
# logger.info("Wechat login success, user_id: {}, nickname: {}".format(self.user_id, self.name))
145+
# # start message listener
146+
# itchat.run()
137147
except Exception as e:
138148
logger.exception(e)
139149

0 commit comments

Comments
 (0)