mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 07:01:49 +00:00
fix(telegram): inject media loader through bot deps
This commit is contained in:
@@ -7,6 +7,7 @@ import { readChannelAllowFromStore } from "openclaw/plugin-sdk/conversation-runt
|
||||
import { upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";
|
||||
import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import { dispatchReplyWithBufferedBlockDispatcher } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
|
||||
import { wasSentByBot } from "./sent-message-cache.js";
|
||||
|
||||
export type TelegramBotDeps = {
|
||||
@@ -16,6 +17,7 @@ export type TelegramBotDeps = {
|
||||
upsertChannelPairingRequest: typeof upsertChannelPairingRequest;
|
||||
enqueueSystemEvent: typeof enqueueSystemEvent;
|
||||
dispatchReplyWithBufferedBlockDispatcher: typeof dispatchReplyWithBufferedBlockDispatcher;
|
||||
loadWebMedia: typeof loadWebMedia;
|
||||
buildModelsProviderData: typeof buildModelsProviderData;
|
||||
listSkillCommandsForAgents: typeof listSkillCommandsForAgents;
|
||||
wasSentByBot: typeof wasSentByBot;
|
||||
@@ -40,6 +42,9 @@ export const defaultTelegramBotDeps: TelegramBotDeps = {
|
||||
get dispatchReplyWithBufferedBlockDispatcher() {
|
||||
return dispatchReplyWithBufferedBlockDispatcher;
|
||||
},
|
||||
get loadWebMedia() {
|
||||
return loadWebMedia;
|
||||
},
|
||||
get buildModelsProviderData() {
|
||||
return buildModelsProviderData;
|
||||
},
|
||||
|
||||
@@ -481,6 +481,7 @@ export const dispatchTelegramMessage = async ({
|
||||
replies: [payload],
|
||||
onVoiceRecording: sendRecordVoice,
|
||||
silent: silentErrorReplies && payload.isError === true,
|
||||
mediaLoader: telegramDeps.loadWebMedia,
|
||||
});
|
||||
if (result.delivered) {
|
||||
deliveryState.markDelivered();
|
||||
@@ -867,6 +868,7 @@ export const dispatchTelegramMessage = async ({
|
||||
replies: [{ text: fallbackText }],
|
||||
...deliveryBaseOptions,
|
||||
silent: silentErrorReplies && (dispatchError != null || hadErrorReplyFailureOrSkip),
|
||||
mediaLoader: telegramDeps.loadWebMedia,
|
||||
});
|
||||
sentFallback = result.delivered;
|
||||
}
|
||||
|
||||
@@ -406,6 +406,7 @@ export const telegramBotDepsForTest: TelegramBotDeps = {
|
||||
upsertChannelPairingRequest as TelegramBotDeps["upsertChannelPairingRequest"],
|
||||
enqueueSystemEvent: enqueueSystemEventSpy as TelegramBotDeps["enqueueSystemEvent"],
|
||||
dispatchReplyWithBufferedBlockDispatcher,
|
||||
loadWebMedia: loadWebMedia as TelegramBotDeps["loadWebMedia"],
|
||||
buildModelsProviderData: buildModelsProviderData as TelegramBotDeps["buildModelsProviderData"],
|
||||
listSkillCommandsForAgents:
|
||||
listSkillCommandsForAgents as TelegramBotDeps["listSkillCommandsForAgents"],
|
||||
|
||||
Reference in New Issue
Block a user