Skip to content

Nonebot Plugin Alconna 0.32.0

Compare
Choose a tag to compare
@RF-Tar-Railt RF-Tar-Railt released this 08 Nov 06:40
· 285 commits to master since this release

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)}")
  • gotgot_path 的消息来源现在由 Extension 完成
  • receiveid 参数为空的时候 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