Skip to content

Nonebot Plugin Alconna 0.12.0

Compare
Choose a tag to compare
@RF-Tar-Railt RF-Tar-Railt released this 29 Jul 16:09
· 485 commits to master since this release

变更

  • AlconnaMatcher 新增方法 got_path, 其作为 got 方法的拓展,会以 path 上的参数为准,读取传入 message的最后一个消息段并验证转换
    from nonebot_plugin_alconna import on_alconna, AlconnaMatcher, AlconnaMatch, AlconnaArg
    
    test_cmd = on_alconna(Alconna("search", Args["img?", Image]))
    
    @test_cmd.handle()
    async def test_handle(matcher: AlconnaMatcher, img: Match[Image] = AlconnaMatch("img")):
        if img.available:
            matcher.set_path_arg("img", img.result)
    
    @test_cmd.got_path("img", prompt="请输入图片")
    async def test_got(img: Image = AlconnaArg("img")):
        await test_cmd.finish(await search(img.url))
  • AlconnaMatcher 增加方法 set_path_arg, get_path_arg , 类似 set_arg, get_arg

Full Changelog: v0.11.2...v0.12.0