Skip to content

Commit

Permalink
[Doc] Add Extension API send_forward_msg Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ishkong authored Feb 27, 2024
1 parent 3518ef7 commit 56069ba
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion docs/Lagrange.OneBot/API/Extend/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# 拓展API
# 拓展API

## 构造合并转发消息

**方法名**
`send_forward_msg`

**参数**

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `messages` | list[OneBotSegment.node] | 参考下方 |

其中`OneBotSegment.node``data`部分要求如下

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `name` | string | 自定义消息发送者昵称 |
| `uin` | string | 自定义消息发送者QQ号 |
| `content` | list[OneBotSegment] | 消息内容 |

**响应数据**

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `resid` | string | Resid |

:::tip
**发送合并转发消息**

请使用标准消息发送API发送一个`"type": "forward", "id": Resid``OneBotSegment`消息


**参考代码**

::: code-group

```python{10-11} [Nonebot OneBot V11]
from nonebot.adapters.onebot.v11 import MessageSegment
async def test_send_forward_message(target_id: int):
messages = [
{
"type": "node",
"data": {"name": "小助手", "uin": "2854196310", "content": [MessageSegment.text("测试消息")]},
}
]
res_id = await bot.call_api("send_forward_msg", messages=messages)
await bot.send_group_msg(group_id=target_id, message=MessageSegment.forward(res_id))
```

:::

0 comments on commit 56069ba

Please sign in to comment.