refactor(plugins): move channel behavior into plugins

This commit is contained in:
Peter Steinberger
2026-04-03 17:54:01 +01:00
parent c52df32878
commit ab96520bba
158 changed files with 5967 additions and 5054 deletions

View File

@@ -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,
};
}

View File

@@ -91,7 +91,7 @@ function shouldAllowInvalidConfigForAction(actionCommand: Command, commandPath:
commandPath,
argv: process.argv,
}),
) === "recover-matrix-only"
) === "allow-bundled-recovery"
);
}