Skip to content

Bug: 合并转发 #25

@cklmdoc

Description

@cklmdoc

描述问题

应该是astrbot新版调整了api导致合并转发消息不可用。
【解决方式】
修改src/infrastructure/sending/send_strategies.py

from astrbot.core.message.message_event_result import MessageChain

async def _send_nodes_direct(
    self,
    event: AstrMessageEvent,
    nodes: list[Comp.Node]
) -> bool:

    try:
        forward_chain = MessageChain(chain=[Comp.Nodes(nodes=nodes)])
        await self._context.send_message(event.unified_msg_origin,forward_chain)

        logger.info("[forward] send completed: nodes=%d",len(nodes))
        return True

    except Exception as exc:
        logger.exception("[forward] send failed: nodes=%d, error=%s",
            len(nodes),
            exc
        )

        return False

复现步骤

【astrbot版本】
v4.25.1
【发送模式】
auto在图片数量>1时使用转发。

期望的结果

No response

截图或日志

[2026-05-27 10:03:26.242] [Plug]
[ERRO]
[v4.25.1] [sending.send_strategies:242]: [setu] [forward] send failed: nodes=2, error=1 validation error for Forward
id
field required (type=value_error.missing)
Traceback (most recent call last):
File "/AstrBot/data/plugins/astrbot_plugin_setu/src/infrastructure/sending/send_strategies.py", line 235, in send_nodes_direct
forward_chain = [Comp.Forward(node=node) for node in nodes]
^^^^^^^^^^^^^^^^^^^^^^^
File "/AstrBot/astrbot/core/message/components.py", line 567, in init
super().init(**
)
File "/AstrBot/astrbot/core/message/components.py", line 73, in init
super().init(**kwargs)
File "/usr/local/lib/python3.12/site-packages/pydantic/v1/main.py", line 364, in init
raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for Forward
id
field required (type=value_error.missing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions