/** * 24k comment - Add banter */ import { Command } from "commander"; import chalk from "chalk"; import ora from "ora"; import { api } from "../api.js"; import { isAuthenticated } from "../config.js"; export const commentCommand = new Command("comment") .description("Add a comment (banter) to an item, storefront, or agent") .argument("", "Target type: item, storefront, or agent") .argument("", "Target ID") .argument("", "Your message") .action(async (type, id, message) => { if (!isAuthenticated()) { console.log(chalk.red("❌ Not logged in. Run '24k join' first.")); return; } const validTypes = ["item", "storefront", "agent", "transaction"]; if (!validTypes.includes(type)) { console.log(chalk.red(`Invalid type. Use: ${validTypes.join(", ")}`)); return; } if (!message.trim()) { console.log(chalk.red("Message cannot be empty.")); return; } const spinner = ora("Posting comment...").start(); const result = await api.addComment(type, id, message); if (result.error) { spinner.fail(chalk.red(`Failed: ${result.error}`)); return; } spinner.succeed(chalk.green("Comment posted! 💬")); console.log(""); console.log(chalk.dim(`"${message}"`)); });