diff --git a/extensions/slack/src/monitor/slash.ts b/extensions/slack/src/monitor/slash.ts index 188214f89f5..95de43f0e81 100644 --- a/extensions/slack/src/monitor/slash.ts +++ b/extensions/slack/src/monitor/slash.ts @@ -3,13 +3,13 @@ import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pi import { resolveCommandAuthorizedFromAuthorizers, resolveNativeCommandSessionTargets, + getPluginCommandSpecs, } from "openclaw/plugin-sdk/command-auth"; import { type ChatCommandDefinition, type CommandArgs } from "openclaw/plugin-sdk/command-auth"; import { resolveNativeCommandsEnabled, resolveNativeSkillsEnabled, } from "openclaw/plugin-sdk/config-runtime"; -import { getPluginCommandSpecs } from "openclaw/plugin-sdk/command-auth"; import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime"; import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env"; import { chunkItems, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime"; @@ -676,7 +676,9 @@ export async function registerSlackMonitorSlashCommands(params: { ); for (const pluginCommand of getPluginCommandSpecs("slack")) { const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name); - if (!normalizedName || existingNativeNames.has(normalizedName)) continue; + if (!normalizedName || existingNativeNames.has(normalizedName)) { + continue; + } existingNativeNames.add(normalizedName); nativeCommands.push(pluginCommand); } diff --git a/src/plugins/command-registry-state.ts b/src/plugins/command-registry-state.ts index 92bf3a7637d..dcd2f871e90 100644 --- a/src/plugins/command-registry-state.ts +++ b/src/plugins/command-registry-state.ts @@ -76,9 +76,9 @@ export function getPluginCommandSpecs(provider?: string): Array<{ if (providerName) { const channelPlugin = getChannelPlugin(providerName); if ( - channelPlugin && - !channelPlugin.capabilities?.nativeCommands && - !channelPlugin.commands?.nativeCommandsAutoEnabled + !channelPlugin || + (!channelPlugin.capabilities?.nativeCommands && + !channelPlugin.commands?.nativeCommandsAutoEnabled) ) { return []; } diff --git a/src/plugins/commands.test.ts b/src/plugins/commands.test.ts index f04d7e4cdc0..a2a5e53210d 100644 --- a/src/plugins/commands.test.ts +++ b/src/plugins/commands.test.ts @@ -202,6 +202,17 @@ beforeEach(() => { }, }, }, + { + pluginId: "slack", + source: "test", + plugin: { + ...createChannelTestPluginBase({ + id: "slack", + label: "Slack", + capabilities: { nativeCommands: true, chatTypes: ["direct", "group"] }, + }), + }, + }, ]), ); });