diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-10 01:15:44 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-10 01:15:44 -0400 |
commit | fc389441f81c8864a3539a7c47279f934cad4cc7 (patch) | |
tree | 0215bdadee5fe4210135ab00ac9de3fec8f53d13 /discord | |
parent | 6ae9cc915d8bba9415910f4c9745e1158a7e1f68 (diff) | |
download | abaddon-portaudio-fc389441f81c8864a3539a7c47279f934cad4cc7.tar.gz abaddon-portaudio-fc389441f81c8864a3539a7c47279f934cad4cc7.zip |
deserialize message attachments for the future
Diffstat (limited to 'discord')
-rw-r--r-- | discord/message.cpp | 10 | ||||
-rw-r--r-- | discord/message.hpp | 16 |
2 files changed, 24 insertions, 2 deletions
diff --git a/discord/message.cpp b/discord/message.cpp index 40c8d58..a622207 100644 --- a/discord/message.cpp +++ b/discord/message.cpp @@ -60,6 +60,16 @@ void from_json(const nlohmann::json &j, EmbedData &m) { 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) { JS_D("id", m.ID); JS_D("channel_id", m.ChannelID); diff --git a/discord/message.hpp b/discord/message.hpp index e4f5b40..de312de 100644 --- a/discord/message.hpp +++ b/discord/message.hpp @@ -107,6 +107,18 @@ struct EmbedData { 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 { Snowflake ID; // Snowflake ChannelID; // @@ -121,8 +133,8 @@ struct Message { std::vector<User> Mentions; // // std::vector<Role> MentionRoles; // // std::vector<ChannelMentionData> MentionChannels; // opt - // std::vector<AttachmentData> Attachments; // - std::vector<EmbedData> Embeds; // + std::vector<AttachmentData> Attachments; // + std::vector<EmbedData> Embeds; // // std::vector<ReactionData> Reactions; // opt std::string Nonce; // opt bool IsPinned; // |