mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 06:11:15 +00:00
fix: call openChat before getChatHistory to load remote messages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user