Skip to content

Commit

Permalink
🔥 更新测试加载工作流,移除旧的适配器注册逻辑,添加对 OneBot V11 的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
fllesser committed Jan 16, 2025
1 parent e7372e0 commit f3d0055
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/test-load.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,8 @@ jobs:
run: |
python -c "
import nonebot;
import tomllib;
from pathlib import Path;
from nonebot.adapters.onebot.v11 import Adapter;
nonebot.init();
data = tomllib.loads(Path("pyproject.toml").read_text(encoding="u8"));
nonebot_data = data.get("tool", {}).get("nonebot")
assert nonebot_data is not None, "Cannot find '[tool.nonebot]' in project toml file!";
assert isinstance(nonebot_data, dict), "[tool.nonebot] must be a table";
adapters = nonebot_data.get("adapters", []);
for ad in adapters:
assert isinstance(ad, dict), "adapter info must be a table"
assert (md := ad.get("module_name")), "adapter must have a module_name"
driver.register_adapter(importlib.import_module(md).Adapter);
nonebot.get_driver().register_adapter(Adapter);
nonebot.load_from_toml('pyproject.toml')
"
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ dependencies = [

[dependency-groups]
dev = [
"nonebot2[fastapi]>=2.4.0,<3.0.0"
"nonebot2[fastapi]>=2.4.0,<3.0.0",
"nonebot-adapter-onebot>=2.4.6,<3.0.0"
]

lint = [
Expand All @@ -26,7 +27,4 @@ lint = [


[tool.nonebot]
adapters = [
{ name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" }
]
plugins = ["nonebot_plugin_template"]

0 comments on commit f3d0055

Please sign in to comment.