fix(photon): wrap text sends with spectrumText helper

This commit is contained in:
underthestars-zhy 2026-06-08 18:45:25 -07:00 committed by Teknium
parent 0646656884
commit fdf48c63c8

View file

@ -69,9 +69,9 @@ if (!projectId || !projectSecret || !sharedToken) {
// Lazy-load spectrum-ts so a missing install fails with a clear message
// instead of a cryptic module-resolution error during import.
let Spectrum, imessage, attachment, voice;
let Spectrum, imessage, attachment, voice, spectrumText;
try {
({ Spectrum, attachment, voice } = await import("spectrum-ts"));
({ Spectrum, attachment, voice, text: spectrumText } = await import("spectrum-ts"));
({ imessage } = await import("spectrum-ts/providers/imessage"));
} catch (e) {
console.error(
@ -424,8 +424,8 @@ const server = http.createServer(async (req, res) => {
}
const space = await resolveSpace(spaceId);
const result = replyTo
? await space.send(text, { replyTo })
: await space.send(text);
? await space.send(spectrumText(text), { replyTo })
: await space.send(spectrumText(text));
return ok(res, { messageId: result?.id || result?.messageId || null });
}
if (req.url === "/send-attachment") {
@ -456,7 +456,7 @@ const server = http.createServer(async (req, res) => {
// after the media so the attachment renders first.
if (caption && typeof caption === "string") {
try {
await space.send(caption);
await space.send(spectrumText(caption));
} catch (e) {
console.error(
"photon-sidecar: attachment sent but caption failed: " +