Skip to content

Commit

Permalink
✨ version 0.7.0
Browse files Browse the repository at this point in the history
resolve #6
  • Loading branch information
RF-Tar-Railt committed Nov 10, 2023
1 parent 2052f60 commit bdcf184
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ SATORI_CLIENTS='
{
"host": "localhost",
"port": "5500",
"path": "",
"token": "xxx"
}
]
Expand All @@ -49,6 +50,8 @@ SATORI_CLIENTS='

`host``port` 为 Satori 服务端的监听地址与端口,

`path` 为 Satori 服务端自定义的监听路径,如 `"/satori"`,默认为 `""`

`token` 由 Satori 服务端决定是否需要。


Expand Down
9 changes: 7 additions & 2 deletions nonebot/adapters/satori/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@

class ClientInfo(BaseModel):
host: str = "localhost"
"""服务端的地址"""
port: int
"""服务端的端口"""
path: str = ""
"""服务端的自定义路径"""
token: Optional[str] = None
"""服务端的 token"""

@property
def identity(self):
return f"{self.host}:{self.port}#{self.token}"

@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):
Expand Down

0 comments on commit bdcf184

Please sign in to comment.