2021-07-19 23:46:29 +08:00
|
|
|
from typing import Dict, Optional
|
2021-01-12 17:55:27 +08:00
|
|
|
|
2021-07-19 23:46:29 +08:00
|
|
|
from pydantic import Field, BaseModel, AnyUrl
|
2021-01-12 17:55:27 +08:00
|
|
|
|
|
|
|
|
2021-01-17 13:46:29 +08:00
|
|
|
# priority: alias > origin
|
|
|
|
class Config(BaseModel):
|
2021-02-05 13:31:33 +08:00
|
|
|
"""
|
|
|
|
CQHTTP 配置类
|
|
|
|
|
|
|
|
:配置项:
|
|
|
|
|
|
|
|
- ``access_token`` / ``cqhttp_access_token``: CQHTTP 协议授权令牌
|
|
|
|
- ``secret`` / ``cqhttp_secret``: CQHTTP HTTP 上报数据签名口令
|
2021-07-19 23:46:29 +08:00
|
|
|
- ``ws_urls`` / ``cqhttp_ws_urls``: CQHTTP 正向 Websocket 连接 Bot ID、目标 URL 字典
|
2021-02-05 13:31:33 +08:00
|
|
|
"""
|
2021-01-17 13:46:29 +08:00
|
|
|
access_token: Optional[str] = Field(default=None,
|
|
|
|
alias="cqhttp_access_token")
|
|
|
|
secret: Optional[str] = Field(default=None, alias="cqhttp_secret")
|
2021-07-19 23:46:29 +08:00
|
|
|
ws_urls: Dict[str, AnyUrl] = Field(default_factory=set,
|
|
|
|
alias="cqhttp_ws_urls")
|
2021-01-12 17:55:27 +08:00
|
|
|
|
|
|
|
class Config:
|
|
|
|
extra = "ignore"
|
2021-03-16 16:17:34 +08:00
|
|
|
allow_population_by_field_name = True
|