fix: guard malformed Telegram replies and pass hook accountId

This commit is contained in:
Ayaan Zaidi
2026-03-03 17:00:40 +05:30
committed by Ayaan Zaidi
parent 5f95f46070
commit 1ded5cc9a9
4 changed files with 62 additions and 3 deletions

View File

@@ -445,12 +445,14 @@ export const registerTelegramNativeCommands = ({
};
const buildCommandDeliveryBaseOptions = (params: {
chatId: string | number;
accountId: string;
mediaLocalRoots?: readonly string[];
threadSpec: ReturnType<typeof resolveTelegramThreadSpec>;
tableMode: ReturnType<typeof resolveMarkdownTableMode>;
chunkMode: ReturnType<typeof resolveChunkMode>;
}) => ({
chatId: String(params.chatId),
accountId: params.accountId,
token: opts.token,
runtime,
bot,
@@ -513,6 +515,7 @@ export const registerTelegramNativeCommands = ({
});
const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
chatId,
accountId: route.accountId,
mediaLocalRoots,
threadSpec,
tableMode,
@@ -726,7 +729,7 @@ export const registerTelegramNativeCommands = ({
return;
}
const { senderId, commandAuthorized, isGroup, isForum, resolvedThreadId } = auth;
const { threadSpec, mediaLocalRoots, tableMode, chunkMode } =
const { threadSpec, route, mediaLocalRoots, tableMode, chunkMode } =
resolveCommandRuntimeContext({
msg,
isGroup,
@@ -735,6 +738,7 @@ export const registerTelegramNativeCommands = ({
});
const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
chatId,
accountId: route.accountId,
mediaLocalRoots,
threadSpec,
tableMode,