feat: 支持收到c2c消息后回复输入中状态

This commit is contained in:
leoqlin
2026-01-31 20:22:37 +08:00
parent d09cd592ce
commit eea1f40684
2 changed files with 35 additions and 1 deletions

View File

@@ -153,6 +153,29 @@ export async function sendC2CMessage(
});
}
/**
* 发送 C2C 输入状态提示(告知用户机器人正在输入)
*/
export async function sendC2CInputNotify(
accessToken: string,
openid: string,
msgId?: string,
inputSecond: number = 60
): Promise<void> {
const msgSeq = msgId ? getNextMsgSeq(msgId) : 1;
const body = {
msg_type: 6,
input_notify: {
input_type: 1,
input_second: inputSecond,
},
msg_seq: msgSeq,
...(msgId ? { msg_id: msgId } : {}),
};
await apiRequest(accessToken, "POST", `/v2/users/${openid}/messages`, body);
}
/**
* 发送频道消息
*/