Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
⬆️ version 0.7.0
Browse files Browse the repository at this point in the history
support nb2 plugin metadata
  • Loading branch information
RF-Tar-Railt committed Jun 1, 2023
1 parent b3117b2 commit 0b7d9fb
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 28 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ QQ 交流群: [链接](https://jq.qq.com/?_wv=1027&k=PUPOnCSH)

## 使用方法

Nonebot文档: [📖这里](https://nonebot.dev/docs/advanced/matcher#alconna)
详细介绍: [📦这里](/docs.md)

### 消息解析
Expand Down
2 changes: 1 addition & 1 deletion docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def on_alconna(
):
```

- `command`: Alconna 命令
- `command`: Alconna 命令或字符串,字符串将通过 `AlconnaFormat` 转换为 Alconna 命令
- `skip_for_unmatch`: 是否在命令不匹配时跳过该响应
- `auto_send_output`: 是否自动发送输出信息并跳过响应
- `output_converter`: 输出信息字符串转换为 Message 方法
Expand Down
32 changes: 16 additions & 16 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[project]
name = "nonebot-plugin-alconna"
version = "0.6.1"
version = "0.7.0"
description = "Alconna Adapter for Nonebot"
authors = [
{name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"},
]
dependencies = [
"nonebot2>=2.0.0rc4",
"arclet-alconna<2.0.0, >=1.7.7",
"arclet-alconna-tools<0.7.0, >=0.6.0",
"arclet-alconna-tools<0.7.0, >=0.6.1",
]
requires-python = ">=3.8"
readme = "README.md"
Expand All @@ -30,6 +30,7 @@ build-backend = "pdm.pep517.api"
[tool.pdm]
[tool.pdm.dev-dependencies]
dev = [
"nonebot2>=2.0.0",
"fix-future-annotations>=0.5.0",
"nonebot-adapter-onebot>=2.2.3",
"nonebot-adapter-feishu>=2.0.0b8",
Expand Down
31 changes: 24 additions & 7 deletions src/nonebot_plugin_alconna/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from nonebot import __version__ as nonebot_version
from nonebot.plugin import PluginMetadata

from .argv import MessageArgv as MessageArgv
Expand All @@ -19,13 +20,29 @@
from .params import match_value as match_value
from .rule import alconna as alconna
from .rule import set_output_converter as set_output_converter
from .config import Config

__plugin_meta__ = PluginMetadata(
name="Alconna 插件",
description="提供 [Alconna](https://github.com/ArcletProject/Alconna) 的 Nonebot2 适配版本与工具",
usage="matcher = on_alconna(...)",
extra={
__version__ = "0.7.0"

_meta_source = {
"name": "Alconna 插件",
"description": "提供 [Alconna](https://github.com/ArcletProject/Alconna) 的 Nonebot2 适配版本与工具",
"usage": "matcher = on_alconna(...)",
"homepage": "https://github.com/ArcletProject/Alconna",
"type": "library",
"config": Config,
"extra": {
"author": "RF-Tar-Railt",
'priority': 16,
"priority": 1,
"version": __version__,
}
)
}


if not nonebot_version.split(".")[-1].isdigit():
_meta_source["extra"]["homepage"] = _meta_source.pop("homepage")
_meta_source["extra"]["type"] = _meta_source.pop("type")
_meta_source["extra"]["config"] = _meta_source.pop("config")


__plugin_meta__ = PluginMetadata(**_meta_source)
4 changes: 2 additions & 2 deletions src/nonebot_plugin_alconna/matcher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from arclet.alconna import Alconna, command_manager
from arclet.alconna.tools import AlconnaString
from arclet.alconna.tools import AlconnaFormat
from nonebot.matcher import Matcher
from nonebot.plugin.on import on_message
from nonebot.rule import Rule
Expand Down Expand Up @@ -43,7 +43,7 @@ def on_alconna(
state: 默认 state
"""
if isinstance(command, str):
command = AlconnaString(command)
command = AlconnaFormat(command)
if aliases and command.command:
command_manager.delete(command)
aliases.add(str(command.command))
Expand Down

0 comments on commit 0b7d9fb

Please sign in to comment.