Skip to content

Releases: nonebot/plugin-alconna

Nonebot Plugin Alconna 0.14.1

14 Aug 04:02
Compare
Choose a tag to compare
  • segmatch 现在支持 Reply 匹配了
  • Reply 的 origin 现在包括原始 segment,适配器特定的reply: Modelreply: Message

Full Changelog: v0.14.0...v0.14.1

Nonebot Plugin Alconna 0.14.0

13 Aug 14:59
Compare
Choose a tag to compare
  • 新增通用标注 Reply:
     class Reply(Segment):
         id: str
         msg: Optional[str]
  • 新增规则 seg_match 与对应的依赖注入 SegMatchMessageSegMatchResult, 用于配合通用标注:
     from nonebot_plugin_alconna import Image, seg_match, SegMatchResult
     
     xxx = on_message(rule=seg_match(Image))
     
     @xxx.handle()
     async def _(image: Image = SegMatchResult(Image)):
         await xxx.send(image.url)

因为nonebot下各适配器对 Reply 元素的处理方式各不相同,同时nonebot既没有约定统一的获取不经过check_tome等的原始消息的接口,也没有统一如MessageEvent.reply的格式,导致此次更新对于获取Reply的内容是毫无帮助的

Full Changelog: v0.13.0...v0.14.0

Nonebot Plugin Alconna 0.13.0

31 Jul 12:41
Compare
Choose a tag to compare

变更

Full Changelog: v0.12.1...v0.13.0

Nonebot Plugin Alconna 0.12.1

30 Jul 03:26
Compare
Choose a tag to compare

变更

  • 修复通用标注无法匹配 telegram 适配器下的图片的问题
  • got_path 先执行 paramless depend

Full Changelog: v0.12.0...v0.12.1

Nonebot Plugin Alconna 0.12.0

29 Jul 16:09
Compare
Choose a tag to compare

变更

  • 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

Nonebot Plugin Alconna 0.11.2

28 Jul 16:02
Compare
Choose a tag to compare

变更

  • 增加配置项目 use_origin,选择是否使用未经 to_me 等处理过的消息来解析

Full Changelog: v0.11.1...v0.11.2

Nonebot Plugin Alconna 0.11.1

28 Jul 12:26
416749d
Compare
Choose a tag to compare
  • 修复通用标注无法匹配频道图片的问题 #1
  • 为tg适配器增加img or url
    Full Changelog: v0.11.0...v0.11.1

Nonebot Plugin Alconna 0.11.0

28 Jul 01:27
Compare
Choose a tag to compare

变更

  • telegram 适配器下的富文本解析支持 in e38d8dc
     from arclet.alconna import Args, Alconna
     from nonebot_plugin_alconna.adapters.telegram import Bold
    
     msg = "/com" + Bold("mand some_arg")
     alc = Alconna("/command", Args["some_arg", Bold])
     assert alc.parse(msg).some_arg.type == "bold"
  • 补全会话配置新增配置项 lite: bool in 66d917d

Full Changelog: v0.10.0...v0.11.0

Nonebot Plugin Alconna 0.10.0

23 Jul 10:44
Compare
Choose a tag to compare

变更

  • on_alconna 现在返回的是 Matcher 子类 AlconnaMatcher
  • AlconnaMatcher 增加了方法 @assign, 作为 @handle([Check(assign(...))]) 的快捷写法:
    from nonebot_plugin_alconna import on_alconna
    
    cmd = on_alconna(...)
    @cmd.assign("foo.bar")
    async def handle_foo_bar(...):
        ...
    其等同于
    from nonebot_plugin_alconna import on_alconna, Check, assign
    
    cmd = on_alconna(...)
    @cmd.handle([Check(assign("foo.bar"))])
    async def handle_foo_bar(...):
        ...

Full Changelog: v0.9.3...v0.10.0

Nonebot Plugin Alconna 0.9.3

22 Jul 16:13
Compare
Choose a tag to compare

变更

  • 新增依赖注入 AlconnaExecResult (Dict[str, Any]), 用来注入绑定在命令上并且 active=True 的响应函数的执行结果
  • 修复 funcommand 自定义命令名称失效的问题
  • funcommand 内部实现改用 on_alconna

Full Changelog: v0.9.0...v0.9.3