发送好友消息。
调用
const result = await api.send_friend_msg(self_id, user_id, message)
参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
self_id |
number | 是 | 在线 Bot QQ 号 |
user_id |
number | 是 | 好友 QQ 号 |
message |
Segment[] | 是 | 消息段数组,支持 text、image 和 QQ 原生 face |
返回值
{ success: true, msg_seq: 123, msg_random: 456 }
示例
await api.send_friend_msg(123456789, 112233445, [
{ type: 'text', data: { text: '你好 🎉 [bq190]' } },
])
text 直接支持 Unicode emoji,并会把 [bq190] 解析为 QQ 自带的 190 号表情。结构化写法为 { type: 'face', data: { kind: 'qq_face', face_id: '190' } }。
user_id 必须使用 QQ 号,不接受 UID。