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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#pragma once
#include <string>
#include <optional>
#include "../util.hpp"
#include "json.hpp"
#include "snowflake.hpp"
enum class PresenceStatus : uint8_t {
Online,
Offline,
Idle,
DND,
};
constexpr inline const char *GetPresenceString(PresenceStatus s) {
switch (s) {
case PresenceStatus::Online:
return "online";
case PresenceStatus::Offline:
return "offline";
case PresenceStatus::Idle:
return "idle";
case PresenceStatus::DND:
return "dnd";
}
return "";
}
enum class ActivityType : int {
Game = 0,
Streaming = 1,
Listening = 2,
Watching = 3, // not documented
Custom = 4,
Competing = 5,
};
enum class ActivityFlags {
INSTANCE = (1 << 0),
JOIN = (1 << 1),
SPECTATE = (1 << 2),
JOIN_REQUEST = (1 << 3),
SYNC = (1 << 4),
PLAY = (1 << 5),
};
template<>
struct Bitwise<ActivityFlags> {
static const bool enable = true;
};
struct ActivityTimestamps {
std::optional<int> Start;
std::optional<int> End;
friend void from_json(const nlohmann::json &j, ActivityTimestamps &m);
friend void to_json(nlohmann::json &j, const ActivityTimestamps &m);
};
struct ActivityEmoji {
std::string Name;
std::optional<Snowflake> ID;
std::optional<bool> IsAnimated;
friend void from_json(const nlohmann::json &j, ActivityEmoji &m);
friend void to_json(nlohmann::json &j, const ActivityEmoji &m);
};
struct ActivityParty {
std::optional<std::string> ID;
std::optional<std::array<int, 2>> Size;
friend void from_json(const nlohmann::json &j, ActivityParty &m);
friend void to_json(nlohmann::json &j, const ActivityParty &m);
};
struct ActivityAssets {
std::optional<std::string> LargeImage;
std::optional<std::string> LargeText;
std::optional<std::string> SmallImage;
std::optional<std::string> SmallText;
friend void from_json(const nlohmann::json &j, ActivityAssets &m);
friend void to_json(nlohmann::json &j, const ActivityAssets &m);
};
struct ActivitySecrets {
std::optional<std::string> Join;
std::optional<std::string> Spectate;
std::optional<std::string> Match;
friend void from_json(const nlohmann::json &j, ActivitySecrets &m);
friend void to_json(nlohmann::json &j, const ActivitySecrets &m);
};
struct ActivityData {
std::string Name; //
ActivityType Type; //
std::optional<std::string> URL; // null
std::optional<uint64_t> CreatedAt; //
std::optional<ActivityTimestamps> Timestamps; //
std::optional<Snowflake> ApplicationID; //
std::optional<std::string> Details; // null
std::optional<std::string> State; // null
std::optional<ActivityEmoji> Emoji; // null
std::optional<ActivityParty> Party; //
std::optional<ActivityAssets> Assets; //
std::optional<ActivitySecrets> Secrets; //
std::optional<bool> IsInstance; //
std::optional<ActivityFlags> Flags; //
friend void from_json(const nlohmann::json &j, ActivityData &m);
friend void to_json(nlohmann::json &j, const ActivityData &m);
};
struct PresenceData {
std::vector<ActivityData> Activities; // null (but never sent as such)
std::string Status;
std::optional<bool> IsAFK;
std::optional<int> Since;
friend void from_json(const nlohmann::json &j, PresenceData &m);
friend void to_json(nlohmann::json &j, const PresenceData &m);
};
|