mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 17:54:32 +00:00
refactor(telegram): simplify send/dispatch/target handling (#17819)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: fcb7aeeca3
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -26,6 +26,7 @@ import { cacheSticker, getCachedSticker } from "../sticker-cache.js";
|
||||
import { resolveTelegramVoiceSend } from "../voice.js";
|
||||
import {
|
||||
buildTelegramThreadParams,
|
||||
resolveTelegramMediaPlaceholder,
|
||||
resolveTelegramReplyId,
|
||||
type TelegramThreadSpec,
|
||||
} from "./helpers.js";
|
||||
@@ -429,16 +430,7 @@ export async function resolveMedia(
|
||||
throw new Error("fetch is not available; set channels.telegram.proxy in config");
|
||||
}
|
||||
const saved = await downloadAndSaveTelegramFile(file.file_path, fetchImpl);
|
||||
let placeholder = "<media:document>";
|
||||
if (msg.photo) {
|
||||
placeholder = "<media:image>";
|
||||
} else if (msg.video) {
|
||||
placeholder = "<media:video>";
|
||||
} else if (msg.video_note) {
|
||||
placeholder = "<media:video>";
|
||||
} else if (msg.audio || msg.voice) {
|
||||
placeholder = "<media:audio>";
|
||||
}
|
||||
const placeholder = resolveTelegramMediaPlaceholder(msg) ?? "<media:document>";
|
||||
return { path: saved.path, contentType: saved.contentType, placeholder };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user