Skip to content

Commit af57f01

Browse files
committed
refactor(auto-reply): share command body resolution
1 parent f2ff510 commit af57f01

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

‎src/auto-reply/command-turn-context.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export type CommandTurnContextInput = {
4747
BotUsername?: unknown;
4848
};
4949

50-
function resolveCommandBody(input: CommandTurnContextInput): string | undefined {
50+
export function resolveCommandBody(input: CommandTurnContextInput): string | undefined {
5151
if (typeof input.commandText === "string") {
5252
return input.commandText;
5353
}

‎src/auto-reply/command-turn-detection.ts‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,11 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
44
import { isControlCommandMessage } from "./command-detection.js";
55
import {
66
isExplicitCommandTurn,
7+
resolveCommandBody,
78
resolveCommandTurnContext,
89
type CommandTurnContextInput,
910
} from "./command-turn-context.js";
1011

11-
function resolveCommandBody(input: CommandTurnContextInput): string | undefined {
12-
if (typeof input.commandText === "string") {
13-
return input.commandText;
14-
}
15-
return (
16-
normalizeOptionalString(input.CommandBody) ??
17-
normalizeOptionalString(input.BodyForCommands) ??
18-
normalizeOptionalString(input.RawBody) ??
19-
normalizeOptionalString(input.Body)
20-
);
21-
}
22-
2312
function resolveVisibleMessageBody(input: CommandTurnContextInput): string | undefined {
2413
if (typeof input.rawText === "string") {
2514
return input.rawText;

0 commit comments

Comments
 (0)