Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Releases: ArcletProject/nonebot-plugin-alconna

Nonebot Plugin Alconna 0.9.0

03 Jul 13:07
Compare
Choose a tag to compare

变更

  • 增加装饰器 funcommand, 用于将一个接受任意参数,返回 strMessageMessageSegment 的函数转换为命令响应器。

     from nonebot_plugin_alconna import funcommand
     
     @funcommand()
     async def echo(msg: str):
         return msg

    签名:

     def funcommand(
         name: str | None = None,
         prefixes: list[str] | None = None,
         description: str | None = None,
     ) -> Callable[[Callable[..., MReturn]], type[Matcher]]:
         ...

Full Changelog: v0.8.3...v0.9.0

Nonebot Plugin Alconna 0.8.3

28 Jun 10:27
Compare
Choose a tag to compare

变更

  • 修复配置命令补全会话后正常解析结果错误的问题

Full Changelog: v0.8.2...v0.8.3

Nonebot Plugin Alconna 0.8.2

25 Jun 15:34
Compare
Choose a tag to compare

变更

  • 增加 "Emoji" 通用段标记
    class Emoji(Segment):
        id: str
        name: Optional[str]

Full Changelog: v0.8.0...v0.8.2

Nonebot Plugin Alconna 0.8.0

22 Jun 16:21
Compare
Choose a tag to compare

变更

  • 添加了通用段模型:

     class Segment:
         origin: MessageSegment
     
     class At(Segment):
         target: str
     
     class Media(Segment):  # Image,Audio,Voice, Video
         url: Optional[str]
         id: Optional[str]
     
     class File(Segment):
         id: str
         name: Optional[str]
  • 通用标注现在将把符合条件的 MessageSegment 在命令解析后转换为对应的通用段模型
    例如:

    • at (ob11), mention (ob12, telegram) -> At
    • file (ob12), document (telegram) -> File
    • Image (mirai), photo (telegram), image (ob11, ...) -> Image
     from nonebot.adapters.onebot.v11 import Message, MessageSegment
     from nonebot_plugin_alconna.adapters import At
     from arclet.alconna import Alconna, Args
     
     msg = Message(["Hello!", MessageSegment.at(123)]) # Hello![CQ:at,qq=123]
     
     alc = Alconna("Hello!", Args["target", At])
     assert alc.parse(msg).matched
    
     target = alc.parse(msg).query("target")
     assert isinstance(target, At)
     assert target.target == '123'

Full Changelog: v0.7.0...v0.8.0

Nonebot Plugin Alconna 0.7.0

01 Jun 09:22
Compare
Choose a tag to compare

变更

  • 支持 Nonebot2 2.0.0 版本的插件元数据格式 #2012
  • 修复 bugs

Full Changelog: v0.6.1...v0.7.0

Nonebot Plugin Alconna 0.6.1

30 May 09:59
Compare
Choose a tag to compare

变更

  • ⬆️ Bump dependabot/fetch-metadata from 1.5.0 to 1.5.1 by @dependabot in #6

  • 修复 aliases 无法使用的 bug

Full Changelog: v0.6.0...v0.6.1

Nonebot Plugin Alconna 0.6.0

27 May 06:56
Compare
Choose a tag to compare

变更

  • ⬆️ Bump dependabot/fetch-metadata from 1.4.0 to 1.5.0 by @dependabot in #4
  • CommandResult 增加属性 source, 表示源 Alconna
  • arclet-alconna 依赖提升至 1.7.7

Full Changelog: v0.5.0...v0.6.0

Nonebot Plugin Alconna 0.5.0

18 May 18:03
Compare
Choose a tag to compare
  • AlconnaRuleon_alconna 移除参数 checker
  • match_value, match_path, assign 转为 Check 使用函数
  • 新增 Check 依赖注入, 用于检查 Arparma 并控制当前事件处理函数是否执行:
    from nonebot_plugin_alconna import Check, assign, on_alconna
    ...
    
    cmd = on_alconna(...)
    # enter when path `foo` exist
    @cmd.handle([Check(lambda arp: arp.find("foo"))])
    async def foo(...):
        ...
    # enter when path `bar.baz` exist
    @cmd.handle([Check(assign("bar.baz"))])
    async def baz(...):
        ...
    Check 接受传入类型为 Arparma, 传出类型为 bool 的函数

Nonebot Plugin Alconna 0.4.0

11 May 06:11
Compare
Choose a tag to compare
  • 升级至 Alconna 1.7.0
  • 支持补全会话,在 on_alconna 中传入参数 comp_config 即可启用
  • 为所有适配器增添特定 Segmeng 标注,并允许像类一样创建 MessageSegment对象:
    from nonebot_plugin_alconna.adpaters.onebot11 import At
    from nonebot.adapters.onebot.v11.message import MessageSegment
    
    assert At(123) == MessageSegmeng.at(123)
  • 增加通用的 Segment 标注:
    • At
    • Image
    • File
    • Video
    • Audio
    • Voice