#ifndef API_BOT_HPP_ #define API_BOT_HPP_ #include template class Discord { private: std::tuple...> net; nlohmann::json data; template void initializeCtx(const nlohmann::json& data, std::index_sequence) { net = std::make_tuple(std::make_unique(data)...); } public: Discord(const nlohmann::json& data) : data(data) { initializeCtx(data, std::index_sequence_for{}); } template [[deprecated("Use ctx() instead")]] auto& get() const { return *std::get>(net); } const auto& ctx() const { return net; } }; class Bot { private: nlohmann::json data; public: Bot(const nlohmann::json& data) : data(data) {}; std::string id() const { return data["d"]["id"]; } bool isBot() const { try { return data["d"]["bot"]; } catch (...) { return false; } } }; #endif