Skip to content

Nonebot Plugin Alconna 0.42.0

Compare
Choose a tag to compare
@RF-Tar-Railt RF-Tar-Railt released this 05 Apr 11:47
· 191 commits to master since this release

What's Changed

  • Target 新增属性 selector, scopeplatform,原 platform 字段改为 adapter
    selector 负责从 bots 中选择符合条件的具体 Bot 实例,scope 可以选择插件内置的 selectoradapterplatform 用于先验条件:
     from nonebot_plugin_alconna import Target, UniMessage, SupportAdapter, SupportScope
     
     async def _():
         # 所有属于 `qq协议端` 的适配器下的 bot 都是可选择的,在无更多条件时随机挑选
         receipt = await Target.group("123456789", SupportScope.qq_client).send(UniMessage.image(path="test.png"))
         # receipt 会使用上次选择的 bot
         await receipt.send(...)
         # 此时仅选择 QQ 适配器的 bot
         await Target.channel_("123456789", SupportScope.qq_api, SupportAdapter.qq).send(UniMessage.image(path="test.png"))
         # 此时在 Satori 适配器下选择 `platform` 参数在 ["chronocat", "lark", "wecom"] 中的 bot
         await Target("123456789", adapter=SupportAdapter.satori, platform={"chronocat", "lark", "wecom"}).send(UniMessage.image(path="test.png"))
  • 新增 SupportScope:
     qq_client = "QQClient"
     """QQ 协议端"""
     qq_api = "QQAPI"
     """QQ 官方接口"""
     telegram = "Telegram"
     discord = "Discord"
     feishu = "Feishu"
     dodo = "DoDo"
     kook = "Kaiheila"
     minecraft = "Minecraft"
     github = "GitHub"
     bilibili = "Bilibili"
     console = "Console"
     ding = "Ding"
     wechat = "WeChat"
     """微信平台"""
     wechat_oap = "WeChatOfficialAccountPlatform"
     """微信公众号平台"""
     wecom = "WeCom"
     """企业微信平台"""
  • Receipt 增加属性 recallableeditable, 用来判断是否能够撤回消息和编辑消息
  • MediaToUrl 函数增加参数 bot: Bot
  • 修复合并转发在 onebot11 下的发送
  • get_bot 可以传入 predicate 参数,原 adapter 作为构建 predicate 的便捷方式
  • ⬆️ Bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 by @dependabot in #42
  • ⬆️ auto update by pre-commit hooks by @pre-commit-ci in #44

Full Changelog: v0.41.1...v0.42.0