#ifndef INTERFACE_BOT_HPP_ #define INTERFACE_BOT_HPP_ #include <includes.hpp> template<typename...Args> class Discord { private: const nlohmann::json& data; std::tuple<std::unique_ptr<Args>...> net; public: Discord(const nlohmann::json& data) : data(data), net(std::make_tuple(std::make_unique<Args>(data)...)) {} template<class T> [[deprecated("Use ctx() instead")]] auto& get() const { return *std::get<std::unique_ptr<T>>(net); } const auto& ctx() const { return net; } }; class Bot { private: const 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