diff options
author | Kyomotoi <[email protected]> | 2022-10-13 16:09:38 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2022-10-13 16:09:38 +0800 |
commit | e4ffbcfb34f56d4ba3330f3e85912a8af30a322c (patch) | |
tree | b09daaea8f28c9e444485db410291ac6fad409ab /ATRI/configs/models.py | |
parent | fa2cdee3c8d4bb103e225416d3322d990a0272fb (diff) | |
download | ATRI-e4ffbcfb34f56d4ba3330f3e85912a8af30a322c.tar.gz ATRI-e4ffbcfb34f56d4ba3330f3e85912a8af30a322c.tar.bz2 ATRI-e4ffbcfb34f56d4ba3330f3e85912a8af30a322c.zip |
♻️ 重构 config 加载项
Diffstat (limited to 'ATRI/configs/models.py')
-rw-r--r-- | ATRI/configs/models.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ATRI/configs/models.py b/ATRI/configs/models.py new file mode 100644 index 0000000..8043f8a --- /dev/null +++ b/ATRI/configs/models.py @@ -0,0 +1,60 @@ +from typing import List +from pydantic import BaseModel + + +class BotConfig(BaseModel): + host: str + port: int + debug: bool + superusers: set + nickname: set + command_start: set + command_sep: set + session_expire_timeout: int + access_token: str + proxy: str + request_timeout: int + + +class GoCQHTTPAccountList(BaseModel): + uin: int + password: str + protocol: int + + +class WithGoCQHTTP(BaseModel): + enabled: bool + accounts: List[GoCQHTTPAccountList] + download_domain: str + download_version: str + + +class SauceNAO(BaseModel): + key: str + + +class Setu(BaseModel): + reverse_proxy: bool + reverse_proxy_domain: str + + +class ConfigModel(BaseModel): + ConfigVersion: str + BotConfig: BotConfig + WithGoCQHTTP: WithGoCQHTTP + SauceNAO: SauceNAO + Setu: Setu + + +class RuntimeConfig(BaseModel): + host: str + port: int + debug: bool + superusers: set + nickname: set + command_start: set + command_sep: set + session_expire_timeout: int + gocq_accoutns: list + gocq_download_domain: str + gocq_version: str |