mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:47:39 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -105,7 +105,9 @@ export async function deliverReplies(params: {
|
||||
const chunks = chunkText(reply.text || "");
|
||||
for (let i = 0; i < chunks.length; i += 1) {
|
||||
const chunk = chunks[i];
|
||||
if (!chunk) continue;
|
||||
if (!chunk) {
|
||||
continue;
|
||||
}
|
||||
// Only attach buttons to the first chunk.
|
||||
const shouldAttachButtons = i === 0 && replyMarkup;
|
||||
await sendTelegramText(bot, chatId, chunk.html, runtime, {
|
||||
@@ -306,7 +308,9 @@ export async function resolveMedia(
|
||||
logVerbose("telegram: skipping animated/video sticker (only static stickers supported)");
|
||||
return null;
|
||||
}
|
||||
if (!sticker.file_id) return null;
|
||||
if (!sticker.file_id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const file = await ctx.getFile();
|
||||
@@ -389,7 +393,9 @@ export async function resolveMedia(
|
||||
msg.document ??
|
||||
msg.audio ??
|
||||
msg.voice;
|
||||
if (!m?.file_id) return null;
|
||||
if (!m?.file_id) {
|
||||
return null;
|
||||
}
|
||||
const file = await ctx.getFile();
|
||||
if (!file.file_path) {
|
||||
throw new Error("Telegram getFile returned no file_path");
|
||||
@@ -413,10 +419,15 @@ export async function resolveMedia(
|
||||
originalName,
|
||||
);
|
||||
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>";
|
||||
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>";
|
||||
}
|
||||
return { path: saved.path, contentType: saved.contentType, placeholder };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user