From bdcf184b83028ca88e7409fce71dfaa6454a1d34 Mon Sep 17 00:00:00 2001 From: RF-Tar-Railt <3165388245@qq.com> Date: Fri, 10 Nov 2023 22:20:57 +0800 Subject: [PATCH] :sparkles: version 0.7.0 resolve #6 --- README.md | 3 +++ nonebot/adapters/satori/config.py | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 27bb44c..6fe508c 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ SATORI_CLIENTS=' { "host": "localhost", "port": "5500", + "path": "", "token": "xxx" } ] @@ -49,6 +50,8 @@ SATORI_CLIENTS=' `host` 与 `port` 为 Satori 服务端的监听地址与端口, +`path` 为 Satori 服务端自定义的监听路径,如 `"/satori"`,默认为 `""` + `token` 由 Satori 服务端决定是否需要。 diff --git a/nonebot/adapters/satori/config.py b/nonebot/adapters/satori/config.py index 56038da..6bf82b8 100644 --- a/nonebot/adapters/satori/config.py +++ b/nonebot/adapters/satori/config.py @@ -6,8 +6,13 @@ class ClientInfo(BaseModel): host: str = "localhost" + """服务端的地址""" port: int + """服务端的端口""" + path: str = "" + """服务端的自定义路径""" token: Optional[str] = None + """服务端的 token""" @property def identity(self): @@ -15,11 +20,11 @@ def identity(self): @property def api_base(self): - return URL(f"http://{self.host}:{self.port}") / "v1" + return URL(f"http://{self.host}:{self.port}") / self.path / "v1" @property def ws_base(self): - return URL(f"ws://{self.host}:{self.port}") / "v1" + return URL(f"ws://{self.host}:{self.port}") / self.path / "v1" class Config(BaseModel, extra=Extra.ignore):