Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
lgc2333 committed Mar 1, 2024
1 parent 6f5bbfe commit c50e259
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@

_✨ 基于 NoneBot2 的碧蓝档案 Wiki 插件 ✨_

<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
<a href="https://pdm.fming.dev">
<img src="https://img.shields.io/badge/pdm-managed-blueviolet" alt="pdm-managed">
</a>
<a href="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/f4778875-45a4-4688-8e1b-b8c844440abb">
<img src="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/f4778875-45a4-4688-8e1b-b8c844440abb.svg" alt="wakatime">
</a>

<br />

<a href="https://pydantic.dev">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/lgc-NB2Dev/readme/main/template/pyd-v1-or-v2.json" alt="Pydantic Version 1 Or 2" >
</a>
<a href="./LICENSE">
<img src="https://img.shields.io/github/license/lgc2333/nonebot-plugin-bawiki.svg" alt="license">
<img src="https://img.shields.io/github/license/lgc-NB2Dev/nonebot-plugin-bawiki.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-bawiki">
<img src="https://img.shields.io/pypi/v/nonebot-plugin-bawiki.svg" alt="pypi">
<img src="https://img.shields.io/pypi/v/nonebot-plugin-bawiki.svg" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
<a href="https://pypi.python.org/pypi/nonebot-plugin-bawiki">
<img src="https://img.shields.io/pypi/dm/nonebot-plugin-bawiki" alt="pypi download">
</a>
<a href="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/371bbbba-9dba-4e40-883c-72b688876575">
<img src="https://wakatime.com/badge/user/b61b0f9a-f40b-4c82-bc51-0a75c67bfccf/project/371bbbba-9dba-4e40-883c-72b688876575.svg" alt="wakatime">
<img src="https://img.shields.io/pypi/dm/nonebot-plugin-bawiki" alt="pypi download">
</a>

</div>
Expand Down Expand Up @@ -198,6 +207,10 @@ Telegram:[@lgc2333](https://t.me/lgc2333)

## 📝 更新日志

### 0.11.0

- 适配 Pydantic V2 \([#55](https://github.com/lgc-NB2Dev/nonebot-plugin-bawiki/pull/55)\)

### 0.10.4 & 0.10.5

- 修复 `ba爱丽丝的伙伴``ba小心卷狗` 显示的赛季标题错误问题
Expand Down Expand Up @@ -247,9 +260,6 @@ Telegram:[@lgc2333](https://t.me/lgc2333)
### 1.0.0

- 使用 `nonebot-plugin-alconna` 实现多适配器支持

### 0.11.0

- 使用 `playwright` 重构现有的 Pillow 绘图

</details>
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_bawiki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .config import Cfg as Cfg # noqa: E402
from .help import extra, register_help_cmd, usage # noqa: E402

__version__ = "0.10.5.post1"
__version__ = "0.11.0"
__plugin_meta__ = PluginMetadata(
name="BAWiki",
description="碧蓝档案Wiki插件",
Expand Down
16 changes: 11 additions & 5 deletions nonebot_plugin_bawiki/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

from nonebot.compat import PYDANTIC_V2

__all__ = ("model_validator", "field_validator")
__all__ = ("field_validator", "model_validator")

if PYDANTIC_V2:
from pydantic import field_validator as field_validator
from pydantic import model_validator as model_validator
from pydantic import (
field_validator as field_validator, # type: ignore
model_validator as model_validator,
)
else:
from pydantic import root_validator, validator

Expand All @@ -19,7 +21,11 @@ def model_validator(*, mode: Literal["after"]):
...

def model_validator(*, mode: Literal["before", "after"]):
return root_validator(pre=mode == "before", allow_reuse=True)
return root_validator(pre=mode == "before", allow_reuse=True) # type: ignore

def field_validator(__field, *fields, mode: Literal["before", "after"] = "after"):
def field_validator(
__field: str,
*fields,
mode: Literal["before", "after"] = "after",
):
return validator(__field, *fields, pre=mode == "before", allow_reuse=True)
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ description = "A nonebot2 plugin for Blue Archive."
authors = [{ name = "student_2333", email = "lgc2333@126.com" }]
dependencies = [
"nonebot2>=2.2.0",
"pydantic>=1.10.0,<3.0.0,!=2.5.0,!=2.5.1",
"nonebot-adapter-onebot>=2.3.1",
"nonebot-plugin-htmlrender>=0.2.2",
"nonebot-plugin-apscheduler>=0.3.0",
Expand Down Expand Up @@ -54,8 +53,3 @@ includes = []
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.pyright]
pythonVersion = "3.9"
pythonPlatform = "All"
defineConstant = { PYDANTIC_V2 = true }

0 comments on commit c50e259

Please sign in to comment.