From b5cedd7de09207f3a03a00c330e5675ec2f02f47 Mon Sep 17 00:00:00 2001 From: Mix <32300164+mnixry@users.noreply.github.com> Date: Tue, 7 Feb 2023 10:23:56 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E7=9B=91=E5=90=AC`12?= =?UTF-8?q?7.0.0.1`=E5=92=8C`0.0.0.0`=E4=BB=A5=E5=A4=96=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=97=B6=E5=87=BA=E9=94=99,=20fix=20#449?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_gocqhttp/process/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nonebot_plugin_gocqhttp/process/config.py b/nonebot_plugin_gocqhttp/process/config.py index 88426719..54b86144 100644 --- a/nonebot_plugin_gocqhttp/process/config.py +++ b/nonebot_plugin_gocqhttp/process/config.py @@ -2,6 +2,7 @@ from pathlib import Path import chevron + from nonebot_plugin_gocqhttp.exceptions import BadConfigFormat from ..plugin_config import AccountConfig, driver_config, onebot_config @@ -40,11 +41,16 @@ def generate(self): def before_run(self): template_string = self.read() + host = ( + "127.0.0.1" + if driver_config.host.is_loopback or driver_config.host.is_unspecified + else driver_config.host + ) rendered_string = chevron.render( template_string, data={ "account": self.account, - "server_address": f"ws://127.0.0.1:{driver_config.port}/onebot/v11/ws", + "server_address": f"ws://{host}:{driver_config.port}/onebot/v11/ws", "access_token": onebot_config.onebot_access_token or "", }, )