



























@@ -26,6 +26,7 @@ import {
2626import { resolveTelegramPreviewStreamMode } from "./preview-streaming.js";
27272828type TelegramAllowFromInvalidHit = { path: string; entry: string };
29+type TelegramMalformedGroupsHit = { path: string; actualType: string };
2930type TelegramSelectedQuoteToolProgressHit = { path: string; replyToMode: string };
3031type TelegramApiRootBotEndpointHit = {
3132path: string;
@@ -131,6 +132,53 @@ function collectTelegramAllowFromLists(
131132return refs;
132133}
133134135+function describeConfigValueType(value: unknown): string {
136+if (Array.isArray(value)) {
137+return "array";
138+}
139+if (value === null) {
140+return "null";
141+}
142+return typeof value;
143+}
144+145+export function scanTelegramMalformedGroupsConfig(
146+cfg: OpenClawConfig,
147+): TelegramMalformedGroupsHit[] {
148+const hits: TelegramMalformedGroupsHit[] = [];
149+for (const scope of collectTelegramAccountScopes(cfg)) {
150+if (!Object.prototype.hasOwnProperty.call(scope.account, "groups")) {
151+continue;
152+}
153+const groups = scope.account.groups;
154+if (asObjectRecord(groups)) {
155+continue;
156+}
157+hits.push({
158+path: `${scope.prefix}.groups`,
159+actualType: describeConfigValueType(groups),
160+});
161+}
162+return hits;
163+}
164+165+export function collectTelegramMalformedGroupsWarnings(params: {
166+hits: TelegramMalformedGroupsHit[];
167+doctorFixCommand: string;
168+}): string[] {
169+if (params.hits.length === 0) {
170+return [];
171+}
172+const sample = params.hits[0] ?? {
173+path: "channels.telegram.groups",
174+actualType: "unknown",
175+};
176+return [
177+`- ${sanitizeForLog(sample.path)} has invalid Telegram groups shape (${sanitizeForLog(sample.actualType)}); expected an object map keyed by Telegram group/chat id, not an array, string, or null.`,
178+`- Example shape: channels.telegram.groups."-1001234567890".topics."99" = { agentId: "support" }. Use topics for forum-topic routing, then rerun ${params.doctorFixCommand} for any remaining Telegram config cleanup.`,
179+];
180+}
181+134182export function scanTelegramInvalidAllowFromEntries(
135183cfg: OpenClawConfig,
136184): TelegramAllowFromInvalidHit[] {
@@ -557,6 +605,10 @@ export const telegramDoctor: ChannelDoctorAdapter = {
557605normalizeCompatibilityConfig: normalizeTelegramCompatibilityConfig,
558606collectPreviewWarnings: ({ cfg, doctorFixCommand, env }) => [
559607 ...collectTelegramMissingEnvTokenWarnings({ cfg, env }),
608+ ...collectTelegramMalformedGroupsWarnings({
609+hits: scanTelegramMalformedGroupsConfig(cfg),
610+ doctorFixCommand,
611+}),
560612 ...collectTelegramInvalidAllowFromWarnings({
561613hits: scanTelegramInvalidAllowFromEntries(cfg),
562614 doctorFixCommand,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。