Skip to content

Releases: nonebot/plugin-alconna

Nonebot Plugin Alconna 0.32.0

08 Nov 06:40
Compare
Choose a tag to compare

What's Changed

  • 添加函数 referent,其允许根据 alc 对象或命令名称获取对应绑定的 AlconnaMatcher:
    from nonebot_plugin_alconna import referent
    cmd = on_alconna("xxx")
    ...
    cmd1 = referent("xxx")
    assert cmd is cmd1
  • AlconnaMatcher 下的 handle,got,got_path,receive 增加参数 override, 以允许响应函数替换原先位置的响应或在指定位置插入新的响应函数:
    # in foo.py
    cmd = on_alconna("xxx")
    
    @cmd.handle()
    async def _(arp: Arparma):
        await cmd.send(f"0: {(arp.options)}")
    # in bar.py
    from nonebot_plugin_alconna import referent
    cmd = referent("xxx")
    
    @cmd.handle(override=("replace", 0))
    async def _(arp: Arparma):
        await cmd.send(f"1: {(arp.options)}")
    
    @cmd.handle(override=("insert", 0))
    async def _(arp: Arparma):
        await cmd.send(f"2: {(arp.options)}")
  • gotgot_path 的消息来源现在由 Extension 完成
  • receiveid 参数为空的时候 AlconnaMatcher 会使用 UniMessage.get_message_id
  • got_path 现在使用第一个消息段
  • ⬆️ auto update by pre-commit hooks by @pre-commit-ci in #23

Full Changelog: v0.31.7...v0.32.0

Nonebot Plugin Alconna 0.31.7

05 Nov 09:12
Compare
Choose a tag to compare
  • UniMessageget_message_id, get_target, sendevent 参数因现在会读取上下文而变为可选
  • UniMessageget_message_id, get_target 增加参数 adapter: str,与 bot 为二选一

Full Changelog: v0.31.6...v0.31.7

Nonebot Plugin Alconna 0.31.6

05 Nov 02:07
Compare
Choose a tag to compare
  • UniMessage 增加了创建 Segment 的快捷方法:
     msg = UniMessage.reply("123").text("Hello!").image(path="path/to/img")
     assert msg == UniMessage([Reply("123"), "Hello!", Image(path="path/to/img")])

Full Changelog: v0.31.5...v0.31.6

Nonebot Plugin Alconna 0.31.5

04 Nov 11:08
Compare
Choose a tag to compare
  • UniMessageTemplate 的特殊参数增加 $message_id$target
    Full Changelog: v0.31.4...v0.31.5

Nonebot Plugin Alconna 0.31.4

04 Nov 09:21
Compare
Choose a tag to compare

What's Changed

  • ✨ 添加 py.typed 文件 by @shoucandanghehe in #22
  • 增加依赖注入 MessageTarget(), MsgTarget:
     async def _(target: Target= MessageTarget()):
     	...
    
     async def _(target: MsgTarget):
     	...

New Contributors

Full Changelog: v0.31.3...v0.31.4

Nonebot Plugin Alconna 0.31.3

01 Nov 13:33
Compare
Choose a tag to compare
  • 增加依赖注入 MessageId(), MsgId:
     async def _(msg: str = MessageId()):
     	...
    
     async def _(msg: MsgId):
     	...

Full Changelog: v0.31.2...v0.31.3

Nonebot Plugin Alconna 0.31.2

01 Nov 08:42
Compare
Choose a tag to compare

What's Changed

  • Feat: feat & fix for image_fetch function by @lgc2333 in #20
  • fix at & at_all for adapters which distinguish by whether content in "all", "here" or not

New Contributors

Full Changelog: v0.31.1...v0.31.2

Nonebot Plugin Alconna 0.31.1

31 Oct 13:33
Compare
Choose a tag to compare
  • 修复 Feishu, QQ 等适配器下的 uniseg 的问题
  • Extension 增加方法 before_catch, 用于确定哪些参数应由自定义依赖注入处理
  • Extension 只有在 before_catchcatch 方法同时重写的情况下才会进行自定义依赖注入

Full Changelog: v0.31.0...v0.31.1

Nonebot Plugin Alconna 0.31.0

29 Oct 11:23
Compare
Choose a tag to compare

新增

  • 新增 UniMessage.send 方法,其可以通过传入的 Bot对象向响应的事件或自定义目标发送消息:
     from nonebot_plugin_alconna import UniMessage, Target, get_bot
     
     await UniMessage(...).send(Target("xxxx"), get_bot(rand=True))
  • 新增 Receipt,其为 UniMessage.send 的返回值;可通过 Receipt 编辑消息和撤回消息:
     from nonebot_plugin_alconna import UniMessage, Target, get_bot
     
     receipt = await UniMessage(...).send(Target("xxxx"), get_bot(rand=True))
    
     await receipt.edit(UniMessage(...), delay=2).recall(delay=3)
  • 新增 ntchat 适配器的 MessageExporter

改进

  • Reference 的发送现在支持 redonebot11

修复

  • 修复 console 适配器的 MessageExporter 的消息导入错误

Full Changelog: v0.30.7...v0.31.0

Nonebot Plugin Alconna 0.30.7

27 Oct 12:40
Compare
Choose a tag to compare
  • 修复 skip_for_unmatch 未拦截 head_match 为 False 的情况

Full Changelog: v0.30.6...v0.30.7