import type { Command } from "commander"; import type { MessageCliHelpers } from "./helpers.js"; export function registerMessageReadEditDeleteCommands( message: Command, helpers: MessageCliHelpers, ) { helpers .withMessageBase( helpers.withRequiredMessageTarget( message.command("read").description("Read recent messages"), ), ) .option("--limit ", "Result limit") .option("--before ", "Read/search before id") .option("--after ", "Read/search after id") .option("--around ", "Read around id") .option("--include-thread", "Include thread replies (Discord)", false) .action(async (opts) => { await helpers.runMessageAction("read", opts); }); helpers .withMessageBase( helpers.withRequiredMessageTarget( message .command("edit") .description("Edit a message") .requiredOption("--message-id ", "Message id") .requiredOption("-m, --message ", "Message body"), ), ) .option("--thread-id ", "Thread id (Telegram forum thread)") .action(async (opts) => { await helpers.runMessageAction("edit", opts); }); helpers .withMessageBase( helpers.withRequiredMessageTarget( message .command("delete") .description("Delete a message") .requiredOption("--message-id ", "Message id"), ), ) .action(async (opts) => { await helpers.runMessageAction("delete", opts); }); }