What's Changed
* 添加函数 `referent`,其允许根据 alc 对象或命令名称获取对应绑定的 AlconnaMatcher:
python
from nonebot_plugin_alconna import referent
cmd = on_alconna("xxx")
...
cmd1 = referent("xxx")
assert cmd is cmd1
* 为 `AlconnaMatcher` 下的 `handle`,`got`,`got_path`,`receive` 增加参数 `override`, 以允许响应函数替换原先位置的响应或在指定位置插入新的响应函数:
python
in foo.py
cmd = on_alconna("xxx")
cmd.handle()
async def _(arp: Arparma):
await cmd.send(f"0: {(arp.options)}")
python
in bar.py
from nonebot_plugin_alconna import referent
cmd = referent("xxx")
cmd.handle(override=("replace", 0))
async def _(arp: Arparma):
await cmd.send(f"1: {(arp.options)}")
cmd.handle(override=("insert", 0))
async def _(arp: Arparma):
await cmd.send(f"2: {(arp.options)}")
* `got`,`got_path` 的消息来源现在由 Extension 完成
* `receive` 的 `id` 参数为空的时候 `AlconnaMatcher` 会使用 `UniMessage.get_message_id`
* `got_path` 现在使用第一个消息段
* :arrow_up: auto update by pre-commit hooks by pre-commit-ci in https://github.com/nonebot/plugin-alconna/pull/23
**Full Changelog**: https://github.com/nonebot/plugin-alconna/compare/v0.31.7...v0.32.0