mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 11:24:58 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -69,19 +69,25 @@ function formatPayloadForLog(payload: {
|
||||
mediaUrl?: string | null;
|
||||
}) {
|
||||
const lines: string[] = [];
|
||||
if (payload.text) lines.push(payload.text.trimEnd());
|
||||
if (payload.text) {
|
||||
lines.push(payload.text.trimEnd());
|
||||
}
|
||||
const mediaUrl =
|
||||
typeof payload.mediaUrl === "string" && payload.mediaUrl.trim()
|
||||
? payload.mediaUrl.trim()
|
||||
: undefined;
|
||||
const media = payload.mediaUrls ?? (mediaUrl ? [mediaUrl] : []);
|
||||
for (const url of media) lines.push(`MEDIA:${url}`);
|
||||
for (const url of media) {
|
||||
lines.push(`MEDIA:${url}`);
|
||||
}
|
||||
return lines.join("\n").trimEnd();
|
||||
}
|
||||
|
||||
export async function agentViaGatewayCommand(opts: AgentCliOpts, runtime: RuntimeEnv) {
|
||||
const body = (opts.message ?? "").trim();
|
||||
if (!body) throw new Error("Message (--message) is required");
|
||||
if (!body) {
|
||||
throw new Error("Message (--message) is required");
|
||||
}
|
||||
if (!opts.to && !opts.sessionId && !opts.agent) {
|
||||
throw new Error("Pass --to <E.164>, --session-id, or --agent to choose a session");
|
||||
}
|
||||
@@ -158,7 +164,9 @@ export async function agentViaGatewayCommand(opts: AgentCliOpts, runtime: Runtim
|
||||
|
||||
for (const payload of payloads) {
|
||||
const out = formatPayloadForLog(payload);
|
||||
if (out) runtime.log(out);
|
||||
if (out) {
|
||||
runtime.log(out);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user