Files
tg-bot/src/repl.php

22 lines
488 B
PHP

<?php
require_once 'entryPoint.php';
if(!defined("STDIN")) {
define("STDIN", fopen('php://stdin','r'));
}
$room_id = BLUE_ROOM;
$msg_id = 0;
echo "Starting test REPL\n";
foreach ($handlers as $handler) {
$handler->PrintToScreen = true;
}
do {
echo $msg_id, ' > ';
$input = fread(STDIN, 80); // Read up to 80 characters or a newline
$trimmed = trim($input);
echo reply_user($room_id, $msg_id, $trimmed, "th") , "\n";
$msg_id++;
} while($trimmed !== "exit");