Nonebot Plugin Alconna 0.32.0
What's Changed
- 添加函数
referent
,其允许根据 alc 对象或命令名称获取对应绑定的 AlconnaMatcher:from nonebot_plugin_alconna import referent cmd = on_alconna("xxx") ... cmd1 = referent("xxx") assert cmd is cmd1
- 为
AlconnaMatcher
下的handle
,got
,got_path
,receive
增加参数override
, 以允许响应函数替换原先位置的响应或在指定位置插入新的响应函数:# in foo.py cmd = on_alconna("xxx") @cmd.handle() async def _(arp: Arparma): await cmd.send(f"0: {(arp.options)}")
# 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
现在使用第一个消息段- ⬆️ auto update by pre-commit hooks by @pre-commit-ci in #23
Full Changelog: v0.31.7...v0.32.0