12 #include "aegis/config.hpp"
13 #include "aegis/snowflake.hpp"
14 #include "aegis/gateway/objects/role.hpp"
15 #include <nlohmann/json.hpp>
29 void from_json(
const nlohmann::json& j, member& m);
30 void to_json(nlohmann::json& j,
const member& m);
39 from_json(nlohmann::json::parse(_json), *
this);
44 from_json(_json, *
this);
51 std::vector<objects::role> roles;
53 std::string joined_at;
59 inline void from_json(
const nlohmann::json& j,
member& m)
61 if (j.count(
"roles") && !j[
"roles"].is_null())
62 for (
const auto & _role : j[
"roles"])
63 m.roles.push_back(_role);
64 if (j.count(
"nick") && !j[
"nick"].is_null())
65 m.
nick = j[
"nick"].get<std::string>();
66 if (j.count(
"joined_at") && !j[
"joined_at"].is_null())
67 m.joined_at = j[
"joined_at"].get<std::string>();
68 if (j.count(
"mute") && !j[
"mute"].is_null())
70 if (j.count(
"deaf") && !j[
"deaf"].is_null())
74 inline void to_json(nlohmann::json& j,
const member& m)
76 for (
const auto & i : m.roles)
77 j[
"roles"].push_back(i);
79 j[
"joined_at"] = m.joined_at;
Primary class for managing a bot interface.
Definition: core.hpp:157
Definition: member.hpp:35
std::string nick
Definition: member.hpp:52