#ifndef API_USER_HPP_ #define API_USER_HPP_ #include #include #include #include #include #include #include using std::string; using std::cout; using std::endl; using json = nlohmann::json; class User { private: json data; WebSocket& web; NetworkManager& req; public: User(const json& data) : data(data), web(*WebSocket::getInstance(TOKEN_BOT, ALL_INTENTS)), req(*NetworkManager::getInstance()) {} string id() { return data["d"]["author"]["id"]; } string me() const { return req.request("GET", dapi + "/users/@me", web.getToken(), ""); } bool isBot() { try { return data["d"]["author"]["bot"]; } catch (std::exception& e) { return false; } } }; #endif