import { start } from "./commands/start";
import { stop, stopAll, clear } from "./commands/stop";
import { status } from "./commands/status";
import { telegram } from "./commands/telegram";
import { send } from "./commands/send";

const args = process.argv.slice(2);
const command = args[0];

async function main() {
  if (command === "--stop-all") {
    await stopAll();
  } else if (command === "--stop") {
    await stop();
  } else if (command === "--clear") {
    await clear();
  } else if (command === "start") {
    await start(args.slice(1));
  } else if (command === "status") {
    await status();
  } else if (command === "telegram") {
    await telegram();
  } else if (command === "send") {
    await send(args.slice(1));
  } else {
    await start();
  }
}

main().catch((err) => {
  console.error("[QwenClaw] Fatal error:", err);
  process.exit(1);
});
