fix: load bot chat list after TDLib auth to enable message forwarding
Some checks failed
continuous-integration/drone/push Build is failing

Without getChats after login, TDLib doesn't know about the destination
channel and forwardMessages fails with "Chat not found".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
admin
2026-03-22 11:33:46 +01:00
parent 7cd84dbf02
commit 84bb167ce6

View File

@@ -38,6 +38,20 @@ export async function createBotClient(): Promise<tdl.Client> {
})); }));
log.info("Bot client authenticated successfully"); log.info("Bot client authenticated successfully");
// Load chat list so TDLib knows about channels the bot has access to.
// Without this, forwardMessages/copyMessage will fail with "Chat not found".
try {
await client.invoke({
_: "getChats",
chat_list: { _: "chatListMain" },
limit: 200,
});
log.info("Chat list loaded");
} catch (err) {
log.warn({ err }, "Failed to load chat list — forwarding may fail");
}
return client; return client;
} }