From c74bbdd1ff95695909c1543fa09be001dc68d2b9 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 3 May 2026 16:11:30 +0100 Subject: [PATCH] fix(telegram): extract bot info contract --- extensions/telegram/src/bot-info.ts | 16 ++++++++++++++++ extensions/telegram/src/bot.types.ts | 18 +----------------- extensions/telegram/src/channel.ts | 2 +- extensions/telegram/src/monitor.types.ts | 2 +- extensions/telegram/src/probe.ts | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 extensions/telegram/src/bot-info.ts diff --git a/extensions/telegram/src/bot-info.ts b/extensions/telegram/src/bot-info.ts new file mode 100644 index 00000000000..76fac8ef8c4 --- /dev/null +++ b/extensions/telegram/src/bot-info.ts @@ -0,0 +1,16 @@ +export type TelegramBotInfo = { + id: number; + is_bot: true; + first_name: string; + last_name?: string; + username: string; + language_code?: string; + can_join_groups: boolean; + can_read_all_group_messages: boolean; + can_manage_bots: boolean; + supports_inline_queries: boolean; + can_connect_to_business: boolean; + has_main_web_app: boolean; + has_topics_enabled: boolean; + allows_users_to_create_topics: boolean; +}; diff --git a/extensions/telegram/src/bot.types.ts b/extensions/telegram/src/bot.types.ts index 1499e8fbf8c..c00c861d113 100644 --- a/extensions/telegram/src/bot.types.ts +++ b/extensions/telegram/src/bot.types.ts @@ -1,25 +1,9 @@ import type { OpenClawConfig, ReplyToMode } from "openclaw/plugin-sdk/config-types"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import type { TelegramBotDeps } from "./bot-deps.js"; +import type { TelegramBotInfo } from "./bot-info.js"; import type { TelegramTransport } from "./fetch.js"; -export type TelegramBotInfo = { - id: number; - is_bot: true; - first_name: string; - last_name?: string; - username: string; - language_code?: string; - can_join_groups: boolean; - can_read_all_group_messages: boolean; - can_manage_bots: boolean; - supports_inline_queries: boolean; - can_connect_to_business: boolean; - has_main_web_app: boolean; - has_topics_enabled: boolean; - allows_users_to_create_topics: boolean; -}; - export type TelegramBotOptions = { token: string; accountId?: string; diff --git a/extensions/telegram/src/channel.ts b/extensions/telegram/src/channel.ts index 378a4d012dc..ec8236c5cec 100644 --- a/extensions/telegram/src/channel.ts +++ b/extensions/telegram/src/channel.ts @@ -40,7 +40,7 @@ import { resolveTelegramAutoThreadId } from "./action-threading.js"; import { lookupTelegramChatId } from "./api-fetch.js"; import { telegramApprovalCapability } from "./approval-native.js"; import * as auditModule from "./audit.js"; -import type { TelegramBotInfo } from "./bot.types.js"; +import type { TelegramBotInfo } from "./bot-info.js"; import { buildTelegramGroupPeerId } from "./bot/helpers.js"; import { telegramMessageActions as telegramMessageActionsImpl } from "./channel-actions.js"; import { diff --git a/extensions/telegram/src/monitor.types.ts b/extensions/telegram/src/monitor.types.ts index 6d8dd00f760..0d354465a23 100644 --- a/extensions/telegram/src/monitor.types.ts +++ b/extensions/telegram/src/monitor.types.ts @@ -4,7 +4,7 @@ import type { } from "openclaw/plugin-sdk/channel-contract"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; -import type { TelegramBotInfo } from "./bot.types.js"; +import type { TelegramBotInfo } from "./bot-info.js"; export type MonitorTelegramOpts = { token?: string; diff --git a/extensions/telegram/src/probe.ts b/extensions/telegram/src/probe.ts index b835ba33d63..4516a45d4aa 100644 --- a/extensions/telegram/src/probe.ts +++ b/extensions/telegram/src/probe.ts @@ -2,7 +2,7 @@ import type { BaseProbeResult } from "openclaw/plugin-sdk/channel-contract"; import type { TelegramNetworkConfig } from "openclaw/plugin-sdk/config-types"; import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime"; import { fetchWithTimeout } from "openclaw/plugin-sdk/text-runtime"; -import type { TelegramBotInfo } from "./bot.types.js"; +import type { TelegramBotInfo } from "./bot-info.js"; import { resolveTelegramApiBase, resolveTelegramFetch } from "./fetch.js"; import { makeProxyFetch } from "./proxy.js";