$this->telegram($request, $response, $args), default => $response->withStatus(404)->write($this->view()->fetch('404.tpl')), }; } /** * @throws TelegramSDKException * @throws InvalidDatabaseException|GuzzleException */ public function telegram(ServerRequest $request, Response $response, array $args): ResponseInterface { $token = $request->getQueryParam('token'); if (Config::obtain('enable_telegram') && $token === Config::obtain('telegram_request_token')) { Telegram::process($request); return $response->withStatus(204); } return $response->withStatus(400); } }