mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 06:21:36 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -25,12 +25,18 @@ function extractCompactInstructions(params: {
|
||||
? stripMentions(raw, params.ctx, params.cfg, params.agentId)
|
||||
: raw;
|
||||
const trimmed = stripped.trim();
|
||||
if (!trimmed) return undefined;
|
||||
if (!trimmed) {
|
||||
return undefined;
|
||||
}
|
||||
const lowered = trimmed.toLowerCase();
|
||||
const prefix = lowered.startsWith("/compact") ? "/compact" : null;
|
||||
if (!prefix) return undefined;
|
||||
if (!prefix) {
|
||||
return undefined;
|
||||
}
|
||||
let rest = trimmed.slice(prefix.length).trimStart();
|
||||
if (rest.startsWith(":")) rest = rest.slice(1).trimStart();
|
||||
if (rest.startsWith(":")) {
|
||||
rest = rest.slice(1).trimStart();
|
||||
}
|
||||
return rest.length ? rest : undefined;
|
||||
}
|
||||
|
||||
@@ -38,7 +44,9 @@ export const handleCompactCommand: CommandHandler = async (params) => {
|
||||
const compactRequested =
|
||||
params.command.commandBodyNormalized === "/compact" ||
|
||||
params.command.commandBodyNormalized.startsWith("/compact ");
|
||||
if (!compactRequested) return null;
|
||||
if (!compactRequested) {
|
||||
return null;
|
||||
}
|
||||
if (!params.command.isAuthorizedSender) {
|
||||
logVerbose(
|
||||
`Ignoring /compact from unauthorized sender: ${params.command.senderId || "<unknown>"}`,
|
||||
|
||||
Reference in New Issue
Block a user