deserialize message attachments for the future
This commit is contained in:
@@ -60,6 +60,16 @@ void from_json(const nlohmann::json &j, EmbedData &m) {
|
|||||||
JS_O("fields", m.Fields);
|
JS_O("fields", m.Fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void from_json(const nlohmann::json &j, AttachmentData &m) {
|
||||||
|
JS_D("id", m.ID);
|
||||||
|
JS_D("filename", m.Filename);
|
||||||
|
JS_D("size", m.Bytes);
|
||||||
|
JS_D("url", m.URL);
|
||||||
|
JS_D("proxy_url", m.ProxyURL);
|
||||||
|
JS_N("height", m.Height);
|
||||||
|
JS_N("width", m.Width);
|
||||||
|
}
|
||||||
|
|
||||||
void from_json(const nlohmann::json &j, Message &m) {
|
void from_json(const nlohmann::json &j, Message &m) {
|
||||||
JS_D("id", m.ID);
|
JS_D("id", m.ID);
|
||||||
JS_D("channel_id", m.ChannelID);
|
JS_D("channel_id", m.ChannelID);
|
||||||
|
@@ -107,6 +107,18 @@ struct EmbedData {
|
|||||||
friend void from_json(const nlohmann::json &j, EmbedData &m);
|
friend void from_json(const nlohmann::json &j, EmbedData &m);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AttachmentData {
|
||||||
|
Snowflake ID; //
|
||||||
|
std::string Filename; //
|
||||||
|
int Bytes; //
|
||||||
|
std::string URL; //
|
||||||
|
std::string ProxyURL; //
|
||||||
|
int Height = -1; // null
|
||||||
|
int Width = -1; // null
|
||||||
|
|
||||||
|
friend void from_json(const nlohmann::json &j, AttachmentData &m);
|
||||||
|
};
|
||||||
|
|
||||||
struct Message {
|
struct Message {
|
||||||
Snowflake ID; //
|
Snowflake ID; //
|
||||||
Snowflake ChannelID; //
|
Snowflake ChannelID; //
|
||||||
@@ -121,8 +133,8 @@ struct Message {
|
|||||||
std::vector<User> Mentions; //
|
std::vector<User> Mentions; //
|
||||||
// std::vector<Role> MentionRoles; //
|
// std::vector<Role> MentionRoles; //
|
||||||
// std::vector<ChannelMentionData> MentionChannels; // opt
|
// std::vector<ChannelMentionData> MentionChannels; // opt
|
||||||
// std::vector<AttachmentData> Attachments; //
|
std::vector<AttachmentData> Attachments; //
|
||||||
std::vector<EmbedData> Embeds; //
|
std::vector<EmbedData> Embeds; //
|
||||||
// std::vector<ReactionData> Reactions; // opt
|
// std::vector<ReactionData> Reactions; // opt
|
||||||
std::string Nonce; // opt
|
std::string Nonce; // opt
|
||||||
bool IsPinned; //
|
bool IsPinned; //
|
||||||
|
Reference in New Issue
Block a user