Releases: nonebot/plugin-alconna
Releases · nonebot/plugin-alconna
Nonebot Plugin Alconna 0.32.0
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)}")
got
,got_path
的消息来源现在由 Extension 完成receive
的id
参数为空的时候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
UniMessage
的get_message_id
,get_target
,send
的event
参数因现在会读取上下文而变为可选UniMessage
的get_message_id
,get_target
增加参数adapter: str
,与bot
为二选一
Full Changelog: v0.31.6...v0.31.7
Nonebot Plugin Alconna 0.31.6
- 为
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
UniMessageTemplate
的特殊参数增加$message_id
与$target
Full Changelog: v0.31.4...v0.31.5
Nonebot Plugin Alconna 0.31.4
What's Changed
- ✨ 添加 py.typed 文件 by @shoucandanghehe in #22
- 增加依赖注入
MessageTarget()
,MsgTarget
:async def _(target: Target= MessageTarget()): ... async def _(target: MsgTarget): ...
New Contributors
- @shoucandanghehe made their first contribution in #22
Full Changelog: v0.31.3...v0.31.4
Nonebot Plugin Alconna 0.31.3
- 增加依赖注入
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
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
- 修复
Feishu
,QQ
等适配器下的 uniseg 的问题 Extension
增加方法before_catch
, 用于确定哪些参数应由自定义依赖注入处理Extension
只有在before_catch
与catch
方法同时重写的情况下才会进行自定义依赖注入
Full Changelog: v0.31.0...v0.31.1
Nonebot Plugin Alconna 0.31.0
新增
- 新增
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
的发送现在支持red
与onebot11
修复
- 修复 console 适配器的 MessageExporter 的消息导入错误
Full Changelog: v0.30.7...v0.31.0
Nonebot Plugin Alconna 0.30.7
- 修复
skip_for_unmatch
未拦截head_match
为 False 的情况
Full Changelog: v0.30.6...v0.30.7