chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -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 };
}