Skip to content

Commit 57992ac

Browse files
committed
fix(typo): Rename config.ONEBOT_PORTOL_TYPE to config.ONEBOT_PROTOCOL_TYPE
1 parent ca77cf6 commit 57992ac

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

app/models/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ class Config(BaseModel):
4949

5050
ENV: str = "production"
5151
ONEBOT_URL: str = ""
52-
ONEBOT_PORTOL_TYPE: Literal["http", "ws"] = "ws"
52+
ONEBOT_PROTOCOL_TYPE: Literal["http", "ws"] = "ws"
5353
ONEBOT_ACCESS_TOKEN: str = ""
5454
GITHUB_WEBHOOK: List[WebhookConfig] = []
5555

5656
@model_validator(mode='after')
5757
def validate_onebot_url(self) -> 'Config':
5858
"""验证 ONEBOT_URL 的格式是否与 ONEBOT_TYPE 匹配"""
5959
if self.ONEBOT_URL:
60-
if self.ONEBOT_PORTOL_TYPE == "ws" and not (self.ONEBOT_URL.startswith("ws://") or self.ONEBOT_URL.startswith("wss://")): # pylint: disable=line-too-long
60+
if self.ONEBOT_PROTOCOL_TYPE == "ws" and not (self.ONEBOT_URL.startswith("ws://") or self.ONEBOT_URL.startswith("wss://")): # pylint: disable=line-too-long
6161
raise ValueError("当 ONEBOT_TYPE 为 ws 时,ONEBOT_URL 必须以 'ws://' 或 'wss://' 开头")
62-
if self.ONEBOT_PORTOL_TYPE == "http" and not (self.ONEBOT_URL.startswith("http://") or self.ONEBOT_URL.startswith("https://")): # pylint: disable=line-too-long
62+
if self.ONEBOT_PROTOCOL_TYPE == "http" and not (self.ONEBOT_URL.startswith("http://") or self.ONEBOT_URL.startswith("https://")): # pylint: disable=line-too-long
6363
raise ValueError("当 ONEBOT_TYPE 为 http 时,ONEBOT_URL 必须以 'http://' 或 'https://' 开头")
6464
return self
6565

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def lifespan(_: FastAPI):
4848
try:
4949
await BotClient.init_client(
5050
client_type="onebot",
51-
protocol_type=config.ONEBOT_PORTOL_TYPE,
51+
protocol_type=config.ONEBOT_PROTOCOL_TYPE,
5252
url=config.ONEBOT_URL,
5353
access_token=config.ONEBOT_ACCESS_TOKEN
5454
)

0 commit comments

Comments
 (0)