1 && $argv[1] == "--print-json-command-list") { $out = []; foreach($commands as $k => $v) $out[] = ["command"=>$v["command"],"description"=>$v["description"]]; echo json_encode(array_values($out)); exit(0); } // 2. PROCESS COMMAND extract(json_decode(file_get_contents('php://stdin'),1)["message"]); // from, chat, date, text if (isset($commands[$text])) { $commands[$text]["callback"]($from, $chat, $date, $text); }