diff --git a/nonebot_plugin_enatfrp/config.py b/nonebot_plugin_enatfrp/config.py index 7962007..904f6a6 100644 --- a/nonebot_plugin_enatfrp/config.py +++ b/nonebot_plugin_enatfrp/config.py @@ -1,10 +1,10 @@ from typing import Optional, List from nonebot import get_driver -from pydantic import BaseModel, Field, Extra, __version__, AnyUrl +from pydantic import BaseModel, Field, AnyUrl -class Config(BaseModel, extra=Extra.ignore): +class Config(BaseModel): natfrp_api: AnyUrl = Field(default="https://api.natfrp.com/v4") natfrp_token: Optional[str] = Field(default=None) natfrp_at: bool = Field(default=False) @@ -23,11 +23,6 @@ class Config(BaseModel, extra=Extra.ignore): natfrp_cmd_showPCs: List[str] = Field(default=["计算机列表"]) -if __version__[0] == "1": - config: Config = Config.parse_obj(get_driver().config) # type:ignore -elif __version__[0] == "2": - config: Config = Config.model_validate(get_driver().config) # type:ignore -else: - raise Exception(f"不支持的pydantic版本:{__version__}") +config: Config = Config(**get_driver().config.dict()) __all__ = ["Config", "config"] diff --git a/pyproject.toml b/pyproject.toml index f7d12e4..3f469c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-plugin-enatfrp" -version = "0.1.6" +version = "0.1.7" description = "SakuraFrp管理插件" authors = ["eya46 <61458340+eya46@users.noreply.github.com>"] license = "MIT"