openclaw/src/cli/program/message/register.send.ts

46 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-01-14 01:08:15 +00:00
import type { Command } from "commander";
import type { MessageCliHelpers } from "./helpers.js";
export function registerMessageSendCommand(message: Command, helpers: MessageCliHelpers) {
2026-01-14 01:08:15 +00:00
helpers
.withMessageBase(
helpers
.withRequiredMessageTarget(
message
.command("send")
.description("Send a message")
2026-01-16 03:15:07 +00:00
.option("-m, --message <text>", "Message body (required unless --media is set)"),
2026-01-14 01:08:15 +00:00
)
.option(
"--media <path-or-url>",
"Attach media (image/audio/video/document). Accepts local paths or URLs.",
)
2026-03-15 18:49:18 -07:00
.option(
"--interactive <json>",
"Shared interactive payload as JSON (buttons/selects rendered natively by supported channels)",
)
2026-01-14 01:08:15 +00:00
.option(
"--buttons <json>",
"Telegram inline keyboard buttons as JSON (array of button rows)",
)
.option("--components <json>", "Discord components payload as JSON")
.option("--card <json>", "Adaptive Card JSON object (when supported by the channel)")
2026-01-14 01:08:15 +00:00
.option("--reply-to <id>", "Reply-to message id")
.option("--thread-id <id>", "Thread id (Telegram forum thread)")
.option("--gif-playback", "Treat video media as GIF playback (WhatsApp only).", false)
feat: add --force-document to message.send for Telegram (bypass sendPhoto + image optimizer) (#45111) * feat: add --force-document to message.send for Telegram Adds --force-document CLI flag to bypass sendPhoto and use sendDocument instead, avoiding Telegram image compression for PNG/image files. - TelegramSendOpts: add forceDocument field - send.ts: skip sendPhoto when forceDocument=true (mediaSender pattern) - ChannelOutboundContext: add forceDocument field - telegramOutbound.sendMedia: pass forceDocument to sendMessageTelegram - ChannelHandlerParams / DeliverOutboundPayloadsCoreParams: add forceDocument - createChannelOutboundContextBase: propagate forceDocument - outbound-send-service.ts: add forceDocument to executeSendAction params - message-action-runner.ts: read forceDocument from params - message.ts: add forceDocument to MessageSendParams - register.send.ts: add --force-document CLI option * fix: pass forceDocument through telegram action dispatch path The actual send path goes through dispatchChannelMessageAction -> telegramMessageActions.handleAction -> handleTelegramAction, not deliverOutboundPayloads. forceDocument was not being read in readTelegramSendParams or passed to sendMessageTelegram. * fix: apply forceDocument to GIF branch to avoid sendAnimation * fix: add disable_content_type_detection=true to sendDocument for --force-document * fix: add forceDocument to buildSendSchema for agent discoverability * fix: scope telegram force-document detection * test: fix heartbeat target helper typing * fix: skip image optimization when forceDocument is set * fix: persist forceDocument in WAL queue for crash-recovery replay * test: tighten heartbeat target test entry typing --------- Co-authored-by: thepagent <thepagent@users.noreply.github.com> Co-authored-by: Frank Yang <frank.ekn@gmail.com>
2026-03-14 07:43:49 -04:00
.option(
"--force-document",
"Send media as document to avoid Telegram compression (Telegram only). Applies to images and GIFs.",
false,
)
2026-02-13 12:33:45 -06:00
.option(
"--silent",
"Send message silently without notification (Telegram + Discord)",
false,
),
2026-01-14 01:08:15 +00:00
)
.action(async (opts) => {
await helpers.runMessageAction("send", opts);
});
}