mirror of
https://github.com/uowuo/abaddon.git
synced 2024-11-10 14:10:10 +00:00
deserialize message attachments for the future
This commit is contained in:
parent
6ae9cc915d
commit
fc389441f8
@ -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);
|
||||
|
@ -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; //
|
||||
|
Loading…
Reference in New Issue
Block a user