From c1c20491da6adbf6a252e48eff1db65052cf83da Mon Sep 17 00:00:00 2001 From: ningding97 <810793091@qq.com> Date: Tue, 3 Mar 2026 01:31:45 +0800 Subject: [PATCH] fix(telegram): guard token.trim() against undefined to prevent startup crash When account.token is undefined (e.g. missing botToken config), calling .trim() directly throws "Cannot read properties of undefined". Use nullish coalescing to fall back to empty string before trimming. Closes #31944 --- extensions/telegram/src/channel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/telegram/src/channel.ts b/extensions/telegram/src/channel.ts index 0028e993fc0..2869f168a12 100644 --- a/extensions/telegram/src/channel.ts +++ b/extensions/telegram/src/channel.ts @@ -44,7 +44,7 @@ function findTelegramTokenOwnerAccountId(params: { const tokenOwners = new Map(); for (const id of listTelegramAccountIds(params.cfg)) { const account = resolveTelegramAccount({ cfg: params.cfg, accountId: id }); - const token = account.token.trim(); + const token = (account.token ?? "").trim(); if (!token) { continue; } @@ -465,7 +465,7 @@ export const telegramPlugin: ChannelPlugin