mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:28:26 +00:00
fix(telegram): exclude plugin commands from setMyCommands when native=false (openclaw#15164) thanks @Glucksberg
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,7 @@ vi.mock("../pairing/pairing-store.js", () => ({
|
||||
}));
|
||||
|
||||
describe("registerTelegramNativeCommands (plugin auth)", () => {
|
||||
it("caps menu registration at 100 while leaving hidden plugin handlers available", () => {
|
||||
it("does not register plugin commands in menu when native=false but keeps handlers available", () => {
|
||||
const specs = Array.from({ length: 101 }, (_, i) => ({
|
||||
name: `cmd_${i}`,
|
||||
description: `Command ${i}`,
|
||||
@@ -73,14 +73,8 @@ describe("registerTelegramNativeCommands (plugin auth)", () => {
|
||||
opts: { token: "token" },
|
||||
});
|
||||
|
||||
const registered = setMyCommands.mock.calls[0]?.[0] as Array<{
|
||||
command: string;
|
||||
description: string;
|
||||
}>;
|
||||
expect(registered).toHaveLength(100);
|
||||
expect(registered[0]).toEqual({ command: "cmd_0", description: "Command 0" });
|
||||
expect(registered[99]).toEqual({ command: "cmd_99", description: "Command 99" });
|
||||
expect(log).toHaveBeenCalledWith(expect.stringContaining("registering first 100"));
|
||||
expect(setMyCommands).not.toHaveBeenCalled();
|
||||
expect(log).not.toHaveBeenCalledWith(expect.stringContaining("registering first 100"));
|
||||
expect(Object.keys(handlers)).toHaveLength(101);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user