mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 23:01:08 +00:00
refactor(plugins): move channel behavior into plugins
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
import type { Command } from "commander";
|
||||
import { getChannelPlugin } from "../../../channels/plugins/index.js";
|
||||
import type { ChannelMessageActionName } from "../../../channels/plugins/types.js";
|
||||
import type { MessageCliHelpers } from "./helpers.js";
|
||||
|
||||
function resolveThreadCreateRequest(opts: Record<string, unknown>) {
|
||||
const channel = typeof opts.channel === "string" ? opts.channel.trim().toLowerCase() : "";
|
||||
if (channel !== "telegram") {
|
||||
return {
|
||||
action: "thread-create" as const,
|
||||
params: opts,
|
||||
};
|
||||
if (channel) {
|
||||
const request = getChannelPlugin(channel)?.actions?.resolveCliActionRequest?.({
|
||||
action: "thread-create",
|
||||
args: opts,
|
||||
});
|
||||
if (request) {
|
||||
return {
|
||||
action: request.action,
|
||||
params: request.args,
|
||||
};
|
||||
}
|
||||
}
|
||||
const { threadName, ...rest } = opts;
|
||||
return {
|
||||
action: "topic-create" as const,
|
||||
params: {
|
||||
...rest,
|
||||
name: typeof threadName === "string" ? threadName : undefined,
|
||||
},
|
||||
action: "thread-create" as ChannelMessageActionName,
|
||||
params: opts,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ function shouldAllowInvalidConfigForAction(actionCommand: Command, commandPath:
|
||||
commandPath,
|
||||
argv: process.argv,
|
||||
}),
|
||||
) === "recover-matrix-only"
|
||||
) === "allow-bundled-recovery"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user