<?php
declare(strict_types=1);

header('Content-Type: application/json');

$cmd = "cd ../bot && bash start_bot.sh 2>&1";
exec($cmd, $output, $returnVar);

if ($returnVar === 0) {
    echo json_encode(['success' => true, 'output' => implode("\n", $output)]);
} else {
    echo json_encode(['success' => false, 'error' => implode("\n", $output)]);
}
