Skip to content

Nonebot Plugin Alconna 0.24.0

Compare
Choose a tag to compare
@RF-Tar-Railt RF-Tar-Railt released this 18 Sep 13:29
· 403 commits to master since this release

新增

  • UniMessage 增加了 UniMessage.template,其与 MessageTemplate 的用法基本相同
    除此之外,UniMessage 对于 {:XXX} 做了一类拓展。其能够识别例如 At(xxx, yyy)Emoji(aaa, bbb)的字符串并执行
    At(...) 为例:
     UniMessage.template("{:At(user, target)}").format(target="123") == UniMessage(At("user", "123"))
     UniMessage.template("{:At(0, 1)}").format("user", "123")  == UniMessage(At("user", "123"))
     UniMessage.template("{:At(type=user, target=id)}").format(id="123") == UniMessage(At("user", "123"))
     UniMessage.template("{:At(type=user, target=123)}").format() == UniMessage(At("user", "123"))
     # 这种写法只能在 AlconnaMatcher 内使用,并且只有 $event 与 $bot
     UniMeesage.template("{:At(user, $event.get_user_id())}").format(...)  == UniMessage(At("user", USER_ID))
  • AlconnaMatcher 内有关prompt的方法现在可以使用 UniMessageTemplate 了

Full Changelog: v0.23.1...v0.24.0