mirror of
https://github.com/yusufipk/YTChatHub.git
synced 2026-09-11 10:56:17 +00:00
feat: add YouTube channel ID to chat message data model
This commit is contained in:
@@ -306,10 +306,14 @@ function normalizeAction(action: any): ChatMessage | null {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract channel ID from author object (item.author.id contains the YouTube channel ID)
|
||||||
|
const authorChannelId = item.author?.id;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: String(item.id ?? item.timestamp_usec ?? Date.now()),
|
id: String(item.id ?? item.timestamp_usec ?? Date.now()),
|
||||||
author: String(item.author?.name ?? 'Unknown'),
|
author: String(item.author?.name ?? 'Unknown'),
|
||||||
authorPhoto: item.author?.thumbnails?.[0]?.url,
|
authorPhoto: item.author?.thumbnails?.[0]?.url,
|
||||||
|
authorChannelId: authorChannelId ? String(authorChannelId) : undefined,
|
||||||
text: resolveMessageText(item),
|
text: resolveMessageText(item),
|
||||||
publishedAt: resolveTimestamp(item.timestamp ?? item.timestamp_usec),
|
publishedAt: resolveTimestamp(item.timestamp ?? item.timestamp_usec),
|
||||||
badges: badges.length > 0 ? badges : undefined,
|
badges: badges.length > 0 ? badges : undefined,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export type ChatMessage = {
|
|||||||
id: string;
|
id: string;
|
||||||
author: string;
|
author: string;
|
||||||
authorPhoto?: string;
|
authorPhoto?: string;
|
||||||
|
authorChannelId?: string;
|
||||||
text: string;
|
text: string;
|
||||||
publishedAt: string;
|
publishedAt: string;
|
||||||
badges?: Badge[];
|
badges?: Badge[];
|
||||||
|
|||||||
Reference in New Issue
Block a user