mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:58:26 +00:00
Telegram: remove @ts-nocheck from bot-message.ts (#9180)
* Telegram: remove @ts-nocheck from bot-message.ts, type deps via Omit<BuildTelegramMessageContextParams> * Telegram: widen allMedia to TelegramMediaRef[] so stickerMetadata flows through * Telegram: remove @ts-nocheck from bot-message.ts (#9180)
This commit is contained in:
@@ -1,8 +1,30 @@
|
||||
// @ts-nocheck
|
||||
import { buildTelegramMessageContext } from "./bot-message-context.js";
|
||||
import type { ReplyToMode } from "../config/config.js";
|
||||
import type { TelegramAccountConfig } from "../config/types.telegram.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import type { TelegramBotOptions } from "./bot.js";
|
||||
import type { TelegramContext, TelegramStreamMode } from "./bot/types.js";
|
||||
import {
|
||||
buildTelegramMessageContext,
|
||||
type BuildTelegramMessageContextParams,
|
||||
type TelegramMediaRef,
|
||||
} from "./bot-message-context.js";
|
||||
import { dispatchTelegramMessage } from "./bot-message-dispatch.js";
|
||||
|
||||
export const createTelegramMessageProcessor = (deps) => {
|
||||
/** Dependencies injected once when creating the message processor. */
|
||||
type TelegramMessageProcessorDeps = Omit<
|
||||
BuildTelegramMessageContextParams,
|
||||
"primaryCtx" | "allMedia" | "storeAllowFrom" | "options"
|
||||
> & {
|
||||
telegramCfg: TelegramAccountConfig;
|
||||
runtime: RuntimeEnv;
|
||||
replyToMode: ReplyToMode;
|
||||
streamMode: TelegramStreamMode;
|
||||
textLimit: number;
|
||||
opts: Pick<TelegramBotOptions, "token">;
|
||||
resolveBotTopicsEnabled: (ctx: TelegramContext) => boolean | Promise<boolean>;
|
||||
};
|
||||
|
||||
export const createTelegramMessageProcessor = (deps: TelegramMessageProcessorDeps) => {
|
||||
const {
|
||||
bot,
|
||||
cfg,
|
||||
@@ -26,7 +48,12 @@ export const createTelegramMessageProcessor = (deps) => {
|
||||
resolveBotTopicsEnabled,
|
||||
} = deps;
|
||||
|
||||
return async (primaryCtx, allMedia, storeAllowFrom, options) => {
|
||||
return async (
|
||||
primaryCtx: TelegramContext,
|
||||
allMedia: TelegramMediaRef[],
|
||||
storeAllowFrom: string[],
|
||||
options?: { messageIdOverride?: string; forceWasMentioned?: boolean },
|
||||
) => {
|
||||
const context = await buildTelegramMessageContext({
|
||||
primaryCtx,
|
||||
allMedia,
|
||||
|
||||
Reference in New Issue
Block a user