public function getUpdates($offset = 0, $limit = 100, $timeout = 0, $update = true)
{
$content = array('offset' => $offset, 'limit' => $limit, 'timeout' => $timeout);
$this->updates = $this->endpoint("getUpdates", $content);
if ($update) {
if (count($this->updates["result"]) >= 1) {
//for CLI working.
$last_element_id = $this->updates["result"][count($this->updates["result"]) - 1]["update_id"] + 1;
$content = array('offset' => $last_element_id, 'limit' => "1", 'timeout' => $timeout);
$this->endpoint("getUpdates", $content);
}
}
return $this->updates;
}