mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 04:30:22 +00:00
feat: expose /compact command in Telegram native menu (openclaw#10352) thanks @akramcodez
Verified: - pnpm build - pnpm check - pnpm test Co-authored-by: akramcodez <179671552+akramcodez@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -409,9 +409,9 @@ function buildChatCommands(): ChatCommandDefinition[] {
|
||||
}),
|
||||
defineChatCommand({
|
||||
key: "compact",
|
||||
nativeName: "compact",
|
||||
description: "Compact the session context.",
|
||||
textAlias: "/compact",
|
||||
scope: "text",
|
||||
category: "session",
|
||||
args: [
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ describe("commands registry", () => {
|
||||
expect(specs.find((spec) => spec.name === "stop")).toBeTruthy();
|
||||
expect(specs.find((spec) => spec.name === "skill")).toBeTruthy();
|
||||
expect(specs.find((spec) => spec.name === "whoami")).toBeTruthy();
|
||||
expect(specs.find((spec) => spec.name === "compact")).toBeFalsy();
|
||||
expect(specs.find((spec) => spec.name === "compact")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("filters commands based on config flags", () => {
|
||||
|
||||
@@ -409,7 +409,7 @@ describe("buildStatusMessage", () => {
|
||||
});
|
||||
|
||||
describe("buildCommandsMessage", () => {
|
||||
it("lists commands with aliases and text-only hints", () => {
|
||||
it("lists commands with aliases and hints", () => {
|
||||
const text = buildCommandsMessage({
|
||||
commands: { config: false, debug: false },
|
||||
} as OpenClawConfig);
|
||||
@@ -418,7 +418,7 @@ describe("buildCommandsMessage", () => {
|
||||
expect(text).toContain("/commands - List all slash commands.");
|
||||
expect(text).toContain("/skill - Run a skill by name.");
|
||||
expect(text).toContain("/think (/thinking, /t) - Set thinking level.");
|
||||
expect(text).toContain("/compact [text] - Compact the session context.");
|
||||
expect(text).toContain("/compact - Compact the session context.");
|
||||
expect(text).not.toContain("/config");
|
||||
expect(text).not.toContain("/debug");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user