feat(onebot): reply into group temp sessions (临时会话) (#212)

send_private_msg / send_msg can now reply to a group temp-session message
by passing the source group_id. Inbound temp messages surface their
source group on sender.group_id; a reply is only made into a temp session
the bot has an inbound record of. Group temp replies route through
RoutingHead.grpTmp (field 3).
This commit is contained in:
DrSmoothl committed 2026-07-10 02:29:18 +08:00
1 parent b37b17f7d8
commit 3c73d1d5b0
19 files changed
+311 -15

No files matched your search

+1
View File
@@ -149,6 +149,7 @@ export interface GroupMessage extends QQEvent {
export interface TempMessage extends QQEvent {
kind: 'temp_message';
senderUin: number;
/** Source group of the temp session (from responseHead.forward), or 0. */
groupId: number;
senderNick: string;
msgSeq: number;
@@ -17,6 +17,10 @@ export const decodeTempMessage: MsgPushDecoder = (ctx) => {
ev.groupId = ctx.responseHead.grp.groupUin ?? 0;
ev.senderNick = ctx.responseHead.grp.memberName ?? '';
}
// A group temp session carries its source group in responseHead.forward.
if (ctx.responseHead?.forward?.tempGroupUin) {
ev.groupId = ctx.responseHead.forward.tempGroupUin;
}
if (!ev.senderNick) {
const friend = ctx.identity.findFriend(ctx.fromUin);
if (friend) ev.senderNick = friend.nickname;