Releases: nonebot/plugin-alconna
Releases · nonebot/plugin-alconna
Nonebot Plugin Alconna 0.14.0
- 新增通用标注
Reply
:class Reply(Segment): id: str msg: Optional[str]
- 新增规则
seg_match
与对应的依赖注入SegMatchMessage
和SegMatchResult
, 用于配合通用标注: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
Nonebot Plugin Alconna 0.12.1
Nonebot Plugin Alconna 0.12.0
变更
- 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
Nonebot Plugin Alconna 0.11.1
- 修复通用标注无法匹配频道图片的问题 #1
- 为tg适配器增加img or url
Full Changelog: v0.11.0...v0.11.1
Nonebot Plugin Alconna 0.11.0
变更
- 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
变更
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
变更
- 新增依赖注入
AlconnaExecResult (Dict[str, Any])
, 用来注入绑定在命令上并且 active=True 的响应函数的执行结果 - 修复
funcommand
自定义命令名称失效的问题 funcommand
内部实现改用 on_alconna
Full Changelog: v0.9.0...v0.9.3