openclaw/src/cli/program/message/register.pins.ts
Peter Steinberger c379191f80 chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
2026-01-14 15:02:19 +00:00

42 lines
1.4 KiB
TypeScript

import type { Command } from "commander";
import type { MessageCliHelpers } from "./helpers.js";
export function registerMessagePinCommands(message: Command, helpers: MessageCliHelpers) {
const withPinsTarget = (command: Command) =>
command.option("--channel-id <id>", "Channel id (defaults to --to; required for WhatsApp)");
const pins = [
helpers
.withMessageBase(
withPinsTarget(
helpers.withMessageTarget(message.command("pin").description("Pin a message")),
),
)
.requiredOption("--message-id <id>", "Message id")
.action(async (opts) => {
await helpers.runMessageAction("pin", opts);
}),
helpers
.withMessageBase(
withPinsTarget(
helpers.withMessageTarget(message.command("unpin").description("Unpin a message")),
),
)
.requiredOption("--message-id <id>", "Message id")
.action(async (opts) => {
await helpers.runMessageAction("unpin", opts);
}),
helpers
.withMessageBase(
helpers.withMessageTarget(message.command("pins").description("List pinned messages")),
)
.option("--channel-id <id>", "Channel id (defaults to --to)")
.option("--limit <n>", "Result limit")
.action(async (opts) => {
await helpers.runMessageAction("list-pins", opts);
}),
] as const;
void pins;
}