/** * @param \TelegramBot\Api\Types\Update $update * @param string $eventName * * @throws \TelegramBot\Api\Exception */ public function trackUpdate(Update $update, $eventName = 'Message') { if (!in_array($update->getUpdateId(), $this->trackedEvents)) { $this->trackedEvents[] = $update->getUpdateId(); $this->track($update->getMessage(), $eventName); if (count($this->trackedEvents) > self::MAX_TRACKED_EVENTS) { $this->trackedEvents = array_slice($this->trackedEvents, round(self::MAX_TRACKED_EVENTS / 4)); } } }