1. 首页
  2. API 文档
  3. 消息与媒体
  4. send_friend_msg

send_friend_msg

  • 发布于 2026-08-16
  • 10 次阅读

发送好友消息。

调用

const result = await api.send_friend_msg(self_id, user_id, message)

参数

参数 类型 必填 说明
self_id number 在线 Bot QQ 号
user_id number 好友 QQ 号
message Segment[] 消息段数组,支持 textimage 和 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。