Scope live chat to the current match and save match history

This commit is contained in:
2026-10-07 00:40:20 -04:00
parent 8fcabe27fc
commit 2b8e102b86
14 changed files with 266 additions and 30 deletions
+3 -2
View File
@@ -17,9 +17,10 @@ export interface ChatContext {
round: number | null;
}
export type ContextualChatEntry = ChatEntry & { context: ChatContext };
export type ContextualChatEntry = ChatEntry & { context: ChatContext; matchId?: number };
export interface ChatMatch {
id?: number;
startedAt: string;
endedAt: string | null;
lastReceivedAt: string;
@@ -174,6 +175,6 @@ export function enrichGameChatTimeline(lines: readonly string[], options: {
}
}
if (entry.type === 'boundary' && entry.event === 'end') logEnded = true;
return { ...entry, context };
return { ...entry, context, ...(match?.id === undefined ? {} : { matchId: match.id }) };
});
}