mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:00:46 +00:00
21 lines
750 B
TypeScript
21 lines
750 B
TypeScript
import { logVerbose } from "../../globals.js";
|
|
import { buildContextReply } from "./commands-context-report.js";
|
|
import type { CommandHandler } from "./commands-types.js";
|
|
|
|
export const handleContextCommand: CommandHandler = async (params, allowTextCommands) => {
|
|
if (!allowTextCommands) {
|
|
return null;
|
|
}
|
|
const normalized = params.command.commandBodyNormalized;
|
|
if (normalized !== "/context" && !normalized.startsWith("/context ")) {
|
|
return null;
|
|
}
|
|
if (!params.command.isAuthorizedSender) {
|
|
logVerbose(
|
|
`Ignoring /context from unauthorized sender: ${params.command.senderId || "<unknown>"}`,
|
|
);
|
|
return { shouldContinue: false };
|
|
}
|
|
return { shouldContinue: false, reply: await buildContextReply(params) };
|
|
};
|