fix: normalize telegram command mentions
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
listChatCommandsForConfig,
|
||||
listNativeCommandSpecs,
|
||||
listNativeCommandSpecsForConfig,
|
||||
normalizeCommandBody,
|
||||
shouldHandleTextCommands,
|
||||
} from "./commands-registry.js";
|
||||
|
||||
@@ -92,4 +93,26 @@ describe("commands registry", () => {
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("normalizes telegram-style command mentions for the current bot", () => {
|
||||
expect(
|
||||
normalizeCommandBody("/help@clawdbot", { botUsername: "clawdbot" }),
|
||||
).toBe("/help");
|
||||
expect(
|
||||
normalizeCommandBody("/help@clawdbot args", {
|
||||
botUsername: "clawdbot",
|
||||
}),
|
||||
).toBe("/help args");
|
||||
expect(
|
||||
normalizeCommandBody("/help@clawdbot: args", {
|
||||
botUsername: "clawdbot",
|
||||
}),
|
||||
).toBe("/help args");
|
||||
});
|
||||
|
||||
it("keeps telegram-style command mentions for other bots", () => {
|
||||
expect(
|
||||
normalizeCommandBody("/help@otherbot", { botUsername: "clawdbot" }),
|
||||
).toBe("/help@otherbot");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user