From c7c60565cb88292d6605606cd5281024e1940b41 Mon Sep 17 00:00:00 2001 From: eya46 <61458340+eya46@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:42:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20config.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_b23/config.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nonebot_plugin_b23/config.py b/nonebot_plugin_b23/config.py index 4e909c6..368b321 100644 --- a/nonebot_plugin_b23/config.py +++ b/nonebot_plugin_b23/config.py @@ -1,20 +1,14 @@ from typing import Set from nonebot import get_driver -from pydantic import BaseModel, Field, Extra, __version__ +from pydantic import BaseModel, Field -class Config(BaseModel, extra=Extra.ignore): +class Config(BaseModel): b23_default_command: str = Field(default='B站热搜') b23_commands: Set[str] = Field(default={'b23', }) b23_block: bool = Field(default=False) b23_priority: int = Field(default=99) b23_max_length: int = Field(default=20, gt=0, lt=101) - -if __version__[0] == "1": - config = Config.parse_obj(get_driver().config) -elif __version__[0] == "2": - config = Config.model_validate(get_driver().config) -else: - raise Exception(f"不支持的pydantic版本:{__version__}") +config = Config(**get_driver().config.dict()) From 10187072814bb7f7dbde6a7953b9c50bb9f22201 Mon Sep 17 00:00:00 2001 From: eya46 <644310932@qq.com> Date: Mon, 12 Feb 2024 22:43:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=85=BC=E5=AE=B9pydantic=20V2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_b23/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonebot_plugin_b23/config.py b/nonebot_plugin_b23/config.py index 368b321..43b90fa 100644 --- a/nonebot_plugin_b23/config.py +++ b/nonebot_plugin_b23/config.py @@ -6,9 +6,10 @@ class Config(BaseModel): b23_default_command: str = Field(default='B站热搜') - b23_commands: Set[str] = Field(default={'b23', }) + b23_commands: Set[str] = Field(default_factory=lambda: {'b23', }) b23_block: bool = Field(default=False) b23_priority: int = Field(default=99) b23_max_length: int = Field(default=20, gt=0, lt=101) + config = Config(**get_driver().config.dict()) From 5198b72afe1ac5b3a36e83e3acb367f39e20c195 Mon Sep 17 00:00:00 2001 From: eya46 <644310932@qq.com> Date: Mon, 12 Feb 2024 22:46:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B00.3.0,=E6=9B=B4?= =?UTF-8?q?=E6=96=B0LICENSE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE.txt | 2 +- readme.md | 6 +----- setup.cfg | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 3754756..c22e402 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ MIT License -Copyright (c) 2018 YOUR NAME +Copyright (c) 2024 eya46 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/readme.md b/readme.md index caef7b2..9a2be26 100644 --- a/readme.md +++ b/readme.md @@ -23,13 +23,9 @@ > pip install nonebot-plugin-b23==0.0.9 -* nonebot2 2.0.0+正式版本👇 - -> pip install nonebot-plugin-b23==0.1.2 - * nonebot2 pydantic<3.0.0,>=1.10.0 -> pip install nonebot-plugin-b23>=0.2.0 +> pip install nonebot-plugin-b23>=0.3.0 ## 配置 diff --git a/setup.cfg b/setup.cfg index 201a022..e669c4e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,4 +5,4 @@ description = nonebot2 plugin B站热搜 long_description = file: readme.md long_description_content_type = text/markdown license = MIT -version = 0.2.0 \ No newline at end of file +version = 0.3.0 \ No newline at end of file