feat: add cross-context messaging resolver
Co-authored-by: Thinh Dinh <tobalsan@users.noreply.github.com>
This commit is contained in:
18
src/cli/program/message/register.broadcast.ts
Normal file
18
src/cli/program/message/register.broadcast.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { Command } from "commander";
|
||||
import type { MessageCliHelpers } from "./helpers.js";
|
||||
|
||||
export function registerMessageBroadcastCommand(message: Command, helpers: MessageCliHelpers) {
|
||||
helpers
|
||||
.withMessageBase(
|
||||
message.command("broadcast").description("Broadcast a message to multiple targets"),
|
||||
)
|
||||
.requiredOption(
|
||||
"--targets <target...>",
|
||||
"Targets to broadcast to (repeatable, accepts names or ids)",
|
||||
)
|
||||
.option("--message <text>", "Message to send")
|
||||
.option("--media <url>", "Media URL")
|
||||
.action(async (options: Record<string, unknown>) => {
|
||||
await helpers.runMessageAction("broadcast", options);
|
||||
});
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { registerMessageReactionsCommands } from "./message/register.reactions.j
|
||||
import { registerMessageReadEditDeleteCommands } from "./message/register.read-edit-delete.js";
|
||||
import { registerMessageSendCommand } from "./message/register.send.js";
|
||||
import { registerMessageThreadCommands } from "./message/register.thread.js";
|
||||
import { registerMessageBroadcastCommand } from "./message/register.broadcast.js";
|
||||
|
||||
export function registerMessageCommands(program: Command, ctx: ProgramContext) {
|
||||
const message = program
|
||||
@@ -41,6 +42,7 @@ ${theme.muted("Docs:")} ${formatDocsLink("/cli/message", "docs.clawd.bot/cli/mes
|
||||
|
||||
const helpers = createMessageCliHelpers(message, ctx.messageChannelOptions);
|
||||
registerMessageSendCommand(message, helpers);
|
||||
registerMessageBroadcastCommand(message, helpers);
|
||||
registerMessagePollCommand(message, helpers);
|
||||
registerMessageReactionsCommands(message, helpers);
|
||||
registerMessageReadEditDeleteCommands(message, helpers);
|
||||
|
||||
Reference in New Issue
Block a user