mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 06:11:15 +00:00
fix: load bot chat list after TDLib auth to enable message forwarding
Some checks failed
continuous-integration/drone/push Build is failing
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user