load(); // TODO log into questbook // loop through: // TODO get last messages // TODO get last messages from matterbridge // TODO post missing messages // $chat = new Questbook(); $bridge = new Matterbridge(); $timestamp = ''; while(true) { $messages = $chat->get($timestamp); $messages = $messages->msgs; foreach ($messages as $msg) { try { $bridge->post($msg[2], $msg[1]); } catch (\Exception $e) { echo 'Error posting'; return; } } $timestamp = ((int) date('U')) * 1000; sleep(2000); }