feat: capture media_album_id from TDLib messages during scanning

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 22:23:47 +01:00
parent ad7790c07b
commit 4baf5aad83
2 changed files with 6 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ interface TdPhotoSize {
interface TdMessage { interface TdMessage {
id: number; id: number;
date: number; date: number;
media_album_id?: string;
content: { content: {
_: string; _: string;
document?: { document?: {
@@ -211,6 +212,7 @@ export async function getChannelMessages(
fileId: String(doc.document.id), fileId: String(doc.document.id),
fileSize: BigInt(doc.document.size), fileSize: BigInt(doc.document.size),
date: new Date(msg.date * 1000), date: new Date(msg.date * 1000),
mediaAlbumId: msg.media_album_id && msg.media_album_id !== "0" ? msg.media_album_id : undefined,
}); });
continue; continue;
} }
@@ -227,6 +229,7 @@ export async function getChannelMessages(
caption, caption,
fileId: String(smallest.photo.id), fileId: String(smallest.photo.id),
fileSize: smallest.photo.size || smallest.photo.expected_size, fileSize: smallest.photo.size || smallest.photo.expected_size,
mediaAlbumId: msg.media_album_id && msg.media_album_id !== "0" ? msg.media_album_id : undefined,
}); });
} }
} }

View File

@@ -201,6 +201,7 @@ export async function getTopicMessages(
messages?: { messages?: {
id: number; id: number;
date: number; date: number;
media_album_id?: string;
content: { content: {
_: string; _: string;
document?: { document?: {
@@ -248,6 +249,7 @@ export async function getTopicMessages(
fileId: String(doc.document.id), fileId: String(doc.document.id),
fileSize: BigInt(doc.document.size), fileSize: BigInt(doc.document.size),
date: new Date(msg.date * 1000), date: new Date(msg.date * 1000),
mediaAlbumId: msg.media_album_id && msg.media_album_id !== "0" ? msg.media_album_id : undefined,
}); });
continue; continue;
} }
@@ -263,6 +265,7 @@ export async function getTopicMessages(
caption, caption,
fileId: String(smallest.photo.id), fileId: String(smallest.photo.id),
fileSize: smallest.photo.size || smallest.photo.expected_size, fileSize: smallest.photo.size || smallest.photo.expected_size,
mediaAlbumId: msg.media_album_id && msg.media_album_id !== "0" ? msg.media_album_id : undefined,
}); });
} }
} }