fix: call openChat before getChatHistory to load remote messages
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
admin
2026-03-21 18:20:30 +01:00
parent c7eb077e0d
commit 4a44374bb7

View File

@@ -154,6 +154,12 @@ export async function getChannelMessages(
const photos: TelegramPhoto[] = [];
const boundary = lastProcessedMessageId ? Number(lastProcessedMessageId) : null;
// Open the chat so TDLib loads remote messages
await invokeWithTimeout(client, {
_: "openChat",
chat_id: Number(chatId),
});
let currentFromId = 0;
let totalScanned = 0;
let pageCount = 0;
@@ -236,6 +242,12 @@ export async function getChannelMessages(
await sleep(config.apiDelayMs);
}
// Close the chat after scanning
await invokeWithTimeout(client, {
_: "closeChat",
chat_id: Number(chatId),
}).catch(() => {}); // Ignore close errors
log.info(
{ chatId: chatId.toString(), archives: archives.length, photos: photos.length, totalScanned, pages: pageCount },
"Channel scan complete"