From e95cbb2eb03f8fb3fb89c780a2edca3fff6e6ec1 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Mon, 20 Feb 2023 23:38:27 +0800 Subject: [PATCH] fix: wechat mp channel listen host change #14 --- README.md | 6 +++++- channel/terminal/terminal_channel.py | 2 +- channel/wechat/wechat_mp_channel.py | 1 + channel/wechat/wechat_mp_service_channel.py | 1 + config-template.json | 3 +++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 05fab35..1b1bd6c 100644 --- a/README.md +++ b/README.md @@ -220,8 +220,12 @@ Hit Ctrl-C to quit. ``` ### 5. Gmail + **需要:** 一个服务器、一个Gmail account -Follow [官方文档](https://support.google.com/mail/answer/185833?hl=en) to create APP password for google account, config as below, then cheers!!! + +Follow [官方文档](https://support.google.com/mail/answer/185833?hl=en) to create APP password for google account, config as below, then cheers!!! (contributed by [Simon](https://github.com/413675377) +) + ```json "channel": { "type": "gmail", diff --git a/channel/terminal/terminal_channel.py b/channel/terminal/terminal_channel.py index c09f279..8a4896c 100644 --- a/channel/terminal/terminal_channel.py +++ b/channel/terminal/terminal_channel.py @@ -8,7 +8,7 @@ class TerminalChannel(Channel): # close log log.close_log() context = {"from_user_id": "User", "stream": True} - print("Please input your question\n") + print("\nPlease input your question") while True: try: prompt = self.get_input("User:\n") diff --git a/channel/wechat/wechat_mp_channel.py b/channel/wechat/wechat_mp_channel.py index 8838dda..c61e823 100644 --- a/channel/wechat/wechat_mp_channel.py +++ b/channel/wechat/wechat_mp_channel.py @@ -24,6 +24,7 @@ class WechatSubsribeAccount(Channel): def startup(self): logger.info('[WX_Public] Wechat Public account service start!') robot.config['PORT'] = channel_conf(const.WECHAT_MP).get('port') + robot.config['HOST'] = '0.0.0.0' robot.run() def handle(self, msg, count=0): diff --git a/channel/wechat/wechat_mp_service_channel.py b/channel/wechat/wechat_mp_service_channel.py index 02ab8cc..7b3c06b 100644 --- a/channel/wechat/wechat_mp_service_channel.py +++ b/channel/wechat/wechat_mp_service_channel.py @@ -20,6 +20,7 @@ class WechatServiceAccount(Channel): robot.config['PORT'] = channel_conf(const.WECHAT_MP).get('port') robot.config["APP_ID"] = channel_conf(const.WECHAT_MP).get('app_id') robot.config["APP_SECRET"] = channel_conf(const.WECHAT_MP).get('app_secret') + robot.config['HOST'] = '0.0.0.0' robot.run() def handle(self, msg, count=0): diff --git a/config-template.json b/config-template.json index c2127f0..b601557 100644 --- a/config-template.json +++ b/config-template.json @@ -15,6 +15,9 @@ "group_name_white_list": ["ChatGPT测试群"], "image_create_prefix": ["画", "看", "找一张"], + "terminal": { + }, + "wechat": { },