summaryrefslogtreecommitdiff
path: root/src/discord/member.hpp
blob: e5d49f4f233924a681cb8ff4c3fa0d534ce57240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include "snowflake.hpp"
#include "json.hpp"
#include "user.hpp"
#include "role.hpp"
#include <string>
#include <vector>

struct GuildMember {
    std::optional<UserData> User; // only reliable to access id. only opt in MESSAGE_*
    std::string Nickname;
    std::vector<Snowflake> Roles;
    std::string JoinedAt;
    std::optional<std::string> PremiumSince; // null
    bool IsDeafened;
    bool IsMuted;
    std::optional<Snowflake> UserID; // present in merged_members
    std::optional<bool> IsPending;   // this uses `pending` not `is_pending`

    // undocuemtned moment !!!1
    std::optional<std::string> Avatar;

    [[nodiscard]] std::vector<RoleData> GetSortedRoles() const;

    void update_from_json(const nlohmann::json &j);
    friend void from_json(const nlohmann::json &j, GuildMember &m);
};