#ifndef INTERFACE_AUTHOR_HPP_ #define INTERFACE_AUTHOR_HPP_ #include #include class Author { private: const nlohmann::json& data; WebSocket& web; NetworkManager& req; public: _deprecated_t("requires update") struct Channel { std::string channel_id; std::string global_name; std::string id; std::string content; std::string avatar; std::string guild_id; std::string discriminator; std::string message_id; bool isPinned; bool isBot; } authorData; const std::string channel_id, global_name, id, content, avatar, guild_id, discriminator, message_id; bool isPinned, isBot; Author(const nlohmann::json& data) : data(data), web(WebSocket::getInstance()), req(NetworkManager::getInstance()), channel_id(functions::testValue(data, { "d", "channel_id" }).value_or("")), global_name(functions::testValue(data, { "d", "author", "global_name" }).value_or("")), id(functions::testValue(data, { "d", "author", "id" }).value_or("")), content(functions::testValue(data, { "d", "content" }).value_or("")), avatar(functions::testValue(data, { "d", "author", "avatar" }).value_or("")), guild_id(functions::testValue(data, { "d", "guild_id" }).value_or("")), discriminator(functions::testValue(data, { "d", "author", "discriminator" }).value_or("")), message_id(functions::testValue(data, { "d", "id" }).value_or("")), isPinned(functions::testValue(data, { "d", "pinned" }).value_or(false)), isBot(functions::testValue(data, { "d", "author", "bot" }).value_or(false)) { } auto send(const nlohmann::json& msg) -> std::string { return req.request(HttpMethods::POST, DiscordEndpoints::details::latest + "/channels/" + data["d"]["channel_id"].get() + "/messages", msg.dump()); } }; #endif