From 1109abc94701af35d4d597fef2510c3b617171ce Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 15 May 2026 07:41:18 +0100 Subject: [PATCH] fix: align Telegram grammY type imports (#81975) --- extensions/telegram/src/bot-handlers.media.ts | 2 +- extensions/telegram/src/bot-handlers.runtime.ts | 2 +- extensions/telegram/src/bot-message-context.ts | 2 +- extensions/telegram/src/bot-native-command-menu.ts | 2 +- extensions/telegram/src/bot-updates.ts | 2 +- extensions/telegram/src/bot/body-helpers.ts | 2 +- .../telegram/src/bot/delivery.resolve-media-retry.test.ts | 2 +- extensions/telegram/src/bot/helpers.ts | 2 +- extensions/telegram/src/bot/types.ts | 2 +- extensions/telegram/src/dm-access.test.ts | 2 +- extensions/telegram/src/dm-access.ts | 2 +- extensions/telegram/src/inline-keyboard.ts | 2 +- extensions/telegram/src/message-cache.test.ts | 2 +- extensions/telegram/src/message-cache.ts | 2 +- extensions/telegram/src/reply-parameters.ts | 2 +- extensions/telegram/src/send.ts | 2 +- extensions/telegram/src/sequential-key.test.ts | 2 +- extensions/telegram/src/sequential-key.ts | 2 +- extensions/telegram/src/status-reaction-variants.ts | 2 +- test/tsconfig/tsconfig.test.json | 3 +++ 20 files changed, 22 insertions(+), 19 deletions(-) diff --git a/extensions/telegram/src/bot-handlers.media.ts b/extensions/telegram/src/bot-handlers.media.ts index 48af2a7fc13d..5392a7ae34d5 100644 --- a/extensions/telegram/src/bot-handlers.media.ts +++ b/extensions/telegram/src/bot-handlers.media.ts @@ -1,4 +1,4 @@ -import type { Message } from "@grammyjs/types"; +import type { Message } from "grammy/types"; import { MediaFetchError } from "openclaw/plugin-sdk/media-runtime"; export function isMediaSizeLimitError(err: unknown): boolean { diff --git a/extensions/telegram/src/bot-handlers.runtime.ts b/extensions/telegram/src/bot-handlers.runtime.ts index 776ba02be18d..272020ecd8f3 100644 --- a/extensions/telegram/src/bot-handlers.runtime.ts +++ b/extensions/telegram/src/bot-handlers.runtime.ts @@ -1,4 +1,4 @@ -import type { Message, ReactionTypeEmoji } from "@grammyjs/types"; +import type { Message, ReactionTypeEmoji } from "grammy/types"; import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/approval-reply-runtime"; import { resolveChannelConfigWrites } from "openclaw/plugin-sdk/channel-config-helpers"; import { diff --git a/extensions/telegram/src/bot-message-context.ts b/extensions/telegram/src/bot-message-context.ts index 74dcda8c3653..bc1975ca0e62 100644 --- a/extensions/telegram/src/bot-message-context.ts +++ b/extensions/telegram/src/bot-message-context.ts @@ -1,4 +1,4 @@ -import type { ReactionTypeEmoji } from "@grammyjs/types"; +import type { ReactionTypeEmoji } from "grammy/types"; import { resolveAckReaction, shouldAckReaction as shouldAckReactionGate, diff --git a/extensions/telegram/src/bot-native-command-menu.ts b/extensions/telegram/src/bot-native-command-menu.ts index 2a22b6668ab7..a7f5b2f1ea3c 100644 --- a/extensions/telegram/src/bot-native-command-menu.ts +++ b/extensions/telegram/src/bot-native-command-menu.ts @@ -1,6 +1,6 @@ import { createHash } from "node:crypto"; -import type { LanguageCode } from "@grammyjs/types"; import type { Bot } from "grammy"; +import type { LanguageCode } from "grammy/types"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; import { diff --git a/extensions/telegram/src/bot-updates.ts b/extensions/telegram/src/bot-updates.ts index cfe0cfc56c16..92525f38fe43 100644 --- a/extensions/telegram/src/bot-updates.ts +++ b/extensions/telegram/src/bot-updates.ts @@ -1,4 +1,4 @@ -import type { Message } from "@grammyjs/types"; +import type { Message } from "grammy/types"; import { createDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime"; import type { TelegramContext } from "./bot/types.js"; diff --git a/extensions/telegram/src/bot/body-helpers.ts b/extensions/telegram/src/bot/body-helpers.ts index d60b5f29597b..a2e9b412a6ae 100644 --- a/extensions/telegram/src/bot/body-helpers.ts +++ b/extensions/telegram/src/bot/body-helpers.ts @@ -1,4 +1,4 @@ -import type { Chat, Message, MessageOrigin, User } from "@grammyjs/types"; +import type { Chat, Message, MessageOrigin, User } from "grammy/types"; import type { NormalizedLocation } from "openclaw/plugin-sdk/channel-inbound"; import { normalizeLowercaseStringOrEmpty, diff --git a/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts b/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts index 23456bc21203..b4c0ade34d5a 100644 --- a/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts +++ b/extensions/telegram/src/bot/delivery.resolve-media-retry.test.ts @@ -1,4 +1,4 @@ -import type { Message } from "@grammyjs/types"; +import type { Message } from "grammy/types"; import { retryAsync } from "openclaw/plugin-sdk/retry-runtime"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { resolveMedia } from "./delivery.resolve-media.js"; diff --git a/extensions/telegram/src/bot/helpers.ts b/extensions/telegram/src/bot/helpers.ts index 716579b17502..fb40f07cbe32 100644 --- a/extensions/telegram/src/bot/helpers.ts +++ b/extensions/telegram/src/bot/helpers.ts @@ -1,4 +1,4 @@ -import type { Chat, Message } from "@grammyjs/types"; +import type { Chat, Message } from "grammy/types"; import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound"; import { resolveCommandAuthorization, diff --git a/extensions/telegram/src/bot/types.ts b/extensions/telegram/src/bot/types.ts index bbb7ff60d1d1..1cea24e99bbe 100644 --- a/extensions/telegram/src/bot/types.ts +++ b/extensions/telegram/src/bot/types.ts @@ -1,4 +1,4 @@ -import type { ChatFullInfo, Message, UserFromGetMe } from "@grammyjs/types"; +import type { ChatFullInfo, Message, UserFromGetMe } from "grammy/types"; /** App-specific stream mode for Telegram stream previews. */ export type TelegramStreamMode = "off" | "partial" | "block" | "progress"; diff --git a/extensions/telegram/src/dm-access.test.ts b/extensions/telegram/src/dm-access.test.ts index 1fb4033ef17b..ed60304f630c 100644 --- a/extensions/telegram/src/dm-access.test.ts +++ b/extensions/telegram/src/dm-access.test.ts @@ -31,7 +31,7 @@ vi.mock("./api-logging.js", () => ({ withTelegramApiErrorLogging: withTelegramApiErrorLoggingMock, })); -import type { Message } from "@grammyjs/types"; +import type { Message } from "grammy/types"; import { normalizeAllowFrom } from "./bot-access.js"; let enforceTelegramDmAccess: typeof import("./dm-access.js").enforceTelegramDmAccess; diff --git a/extensions/telegram/src/dm-access.ts b/extensions/telegram/src/dm-access.ts index 1e4016180192..a1bd7a95890b 100644 --- a/extensions/telegram/src/dm-access.ts +++ b/extensions/telegram/src/dm-access.ts @@ -1,5 +1,5 @@ -import type { Message } from "@grammyjs/types"; import type { Bot } from "grammy"; +import type { Message } from "grammy/types"; import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing"; import type { DmPolicy } from "openclaw/plugin-sdk/config-contracts"; import { upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime"; diff --git a/extensions/telegram/src/inline-keyboard.ts b/extensions/telegram/src/inline-keyboard.ts index eec19b58c179..5b4f2b3ed77e 100644 --- a/extensions/telegram/src/inline-keyboard.ts +++ b/extensions/telegram/src/inline-keyboard.ts @@ -1,4 +1,4 @@ -import type { InlineKeyboardButton, InlineKeyboardMarkup } from "@grammyjs/types"; +import type { InlineKeyboardButton, InlineKeyboardMarkup } from "grammy/types"; import type { TelegramInlineButtons } from "./button-types.js"; function toInlineKeyboardButton( diff --git a/extensions/telegram/src/message-cache.test.ts b/extensions/telegram/src/message-cache.test.ts index c1f5ed1dd41c..e052f9c5474d 100644 --- a/extensions/telegram/src/message-cache.test.ts +++ b/extensions/telegram/src/message-cache.test.ts @@ -1,5 +1,5 @@ import { readFile, rm, writeFile } from "node:fs/promises"; -import type { Message } from "@grammyjs/types"; +import type { Message } from "grammy/types"; import { describe, expect, it } from "vitest"; import { buildTelegramConversationContext, diff --git a/extensions/telegram/src/message-cache.ts b/extensions/telegram/src/message-cache.ts index 2ad0b13bedd4..d234cc675874 100644 --- a/extensions/telegram/src/message-cache.ts +++ b/extensions/telegram/src/message-cache.ts @@ -1,5 +1,5 @@ import fs from "node:fs"; -import type { Message } from "@grammyjs/types"; +import type { Message } from "grammy/types"; import { formatLocationText } from "openclaw/plugin-sdk/channel-inbound"; import type { MsgContext } from "openclaw/plugin-sdk/reply-runtime"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; diff --git a/extensions/telegram/src/reply-parameters.ts b/extensions/telegram/src/reply-parameters.ts index fc9ba8cc8875..b136f165d2a7 100644 --- a/extensions/telegram/src/reply-parameters.ts +++ b/extensions/telegram/src/reply-parameters.ts @@ -1,4 +1,4 @@ -import type { MessageEntity } from "@grammyjs/types"; +import type { MessageEntity } from "grammy/types"; import { buildTelegramThreadParams, type TelegramThreadSpec } from "./bot/helpers.js"; import { normalizeTelegramReplyToMessageId } from "./outbound-params.js"; diff --git a/extensions/telegram/src/send.ts b/extensions/telegram/src/send.ts index b913e40ce1a9..c9bdb901fb3f 100644 --- a/extensions/telegram/src/send.ts +++ b/extensions/telegram/src/send.ts @@ -1,6 +1,6 @@ -import type { ReactionType, ReactionTypeEmoji } from "@grammyjs/types"; import * as grammy from "grammy"; import { type ApiClientOptions, Bot, HttpError } from "grammy"; +import type { ReactionType, ReactionTypeEmoji } from "grammy/types"; import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime"; import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-runtime"; import { formatUncaughtError } from "openclaw/plugin-sdk/error-runtime"; diff --git a/extensions/telegram/src/sequential-key.test.ts b/extensions/telegram/src/sequential-key.test.ts index a89aae578dbe..b981d0edd51f 100644 --- a/extensions/telegram/src/sequential-key.test.ts +++ b/extensions/telegram/src/sequential-key.test.ts @@ -1,4 +1,4 @@ -import type { Chat, Message } from "@grammyjs/types"; +import type { Chat, Message } from "grammy/types"; import { describe, expect, it } from "vitest"; import { getTelegramSequentialKey } from "./sequential-key.js"; diff --git a/extensions/telegram/src/sequential-key.ts b/extensions/telegram/src/sequential-key.ts index 01d86d9ceb89..2b0af12531d1 100644 --- a/extensions/telegram/src/sequential-key.ts +++ b/extensions/telegram/src/sequential-key.ts @@ -1,4 +1,4 @@ -import type { Message, UserFromGetMe } from "@grammyjs/types"; +import type { Message, UserFromGetMe } from "grammy/types"; import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/approval-reply-runtime"; import { listChatCommands, diff --git a/extensions/telegram/src/status-reaction-variants.ts b/extensions/telegram/src/status-reaction-variants.ts index e651453ed7ad..c0bf6f1d7a77 100644 --- a/extensions/telegram/src/status-reaction-variants.ts +++ b/extensions/telegram/src/status-reaction-variants.ts @@ -1,4 +1,4 @@ -import type { ReactionTypeEmoji } from "@grammyjs/types"; +import type { ReactionTypeEmoji } from "grammy/types"; import { DEFAULT_EMOJIS, type StatusReactionEmojis } from "openclaw/plugin-sdk/channel-feedback"; import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime"; import type { TelegramChatDetails, TelegramGetChat } from "./bot/types.js"; diff --git a/test/tsconfig/tsconfig.test.json b/test/tsconfig/tsconfig.test.json index 8840d627aa94..82cbb3af6d7b 100644 --- a/test/tsconfig/tsconfig.test.json +++ b/test/tsconfig/tsconfig.test.json @@ -1,5 +1,8 @@ { "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "../.." + }, "include": [ "../../src/**/*.d.ts", "../../src/**/*.test.ts",