write($this->view()->fetch('index.tpl')); } /** * @throws Exception */ public function tos(ServerRequest $request, Response $response, array $args): ResponseInterface { return $response->write($this->view()->fetch('tos.tpl')); } /** * @throws Exception */ public function staff(ServerRequest $request, Response $response, array $args): ResponseInterface { $user = Auth::getUser(); if (! $user->isLogin) { return $response->withStatus(404)->write($this->view()->fetch('404.tpl')); } return $response->write($this->view()->fetch('staff.tpl')); } /** * @throws TelegramSDKException */ public function telegram(ServerRequest $request, Response $response, array $args): ResponseInterface { $token = $request->getQueryParam('token'); if ($_ENV['enable_telegram'] && $token === $_ENV['telegram_request_token']) { Process::index(); $result = '1'; } else { $result = '0'; } return $response->write($result); } }