mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 02:30:21 +00:00
fix(discord): avoid native plugin command collisions
This commit is contained in:
@@ -59,4 +59,39 @@ describe("registerPluginCommand", () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("supports provider-specific native command aliases", () => {
|
||||
const result = registerPluginCommand("demo-plugin", {
|
||||
name: "voice",
|
||||
nativeNames: {
|
||||
default: "talkvoice",
|
||||
discord: "discordvoice",
|
||||
},
|
||||
description: "Demo command",
|
||||
handler: async () => ({ text: "ok" }),
|
||||
});
|
||||
|
||||
expect(result).toEqual({ ok: true });
|
||||
expect(getPluginCommandSpecs()).toEqual([
|
||||
{
|
||||
name: "talkvoice",
|
||||
description: "Demo command",
|
||||
acceptsArgs: false,
|
||||
},
|
||||
]);
|
||||
expect(getPluginCommandSpecs("discord")).toEqual([
|
||||
{
|
||||
name: "discordvoice",
|
||||
description: "Demo command",
|
||||
acceptsArgs: false,
|
||||
},
|
||||
]);
|
||||
expect(getPluginCommandSpecs("telegram")).toEqual([
|
||||
{
|
||||
name: "talkvoice",
|
||||
description: "Demo command",
|
||||
acceptsArgs: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user