fix(onebot): correct private message history (#256)
Use the C2C roam cursor and canonical NT sequence for bidirectional history. Persist direction-aware recall tombstones so recalled messages cannot reappear.
This commit is contained in:
37 files changed
+1853
-242
No files matched your search
@@ -2,6 +2,15 @@ import { createHash } from 'node:crypto';
|
||||
|
||||
export const GROUP_MESSAGE_EVENT = 'group_message';
|
||||
export const PRIVATE_MESSAGE_EVENT = 'private_message';
|
||||
/** Legacy/fallback namespace for private messages sent by the current account. */
|
||||
export const PRIVATE_SENT_MESSAGE_EVENT = 'private_message_sent';
|
||||
/** Namespace for private messages keyed by QQ's conversation-wide NT sequence. */
|
||||
export const PRIVATE_NT_MESSAGE_EVENT = 'private_message_nt';
|
||||
|
||||
export function privateMessageEventName(sentBySelf: boolean, hasNtSequence: boolean): string {
|
||||
if (hasNtSequence) return PRIVATE_NT_MESSAGE_EVENT;
|
||||
return sentBySelf ? PRIVATE_SENT_MESSAGE_EVENT : PRIVATE_MESSAGE_EVENT;
|
||||
}
|
||||
|
||||
export function hashMessageIdInt32(sequence: number, sessionId: number, eventName: string): number {
|
||||
const seq = Number.isFinite(sequence) ? Math.trunc(sequence) : 0;
|
||||
|
||||
Reference in new issue
Block a user