summaryrefslogtreecommitdiff
path: root/src/discord/webhook.cpp
blob: 318f8c80f1a418571f24faa84f8e9c53c671738f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "webhook.hpp"

void from_json(const nlohmann::json &j, WebhookData &m) {
    JS_D("id", m.ID);
    JS_D("type", m.Type);
    JS_O("guild_id", m.GuildID);
    JS_D("channel_id", m.ChannelID);
    JS_O("user", m.User);
    JS_N("name", m.Name);
    JS_N("avatar", m.Avatar);
    JS_O("token", m.Token);
    JS_N("application_id", m.ApplicationID);
}

std::string WebhookMessageData::GetAvatarURL() const {
    return Avatar.empty() ? "" : "https://cdn.discordapp.com/avatars/" + std::to_string(WebhookID) + "/" + Avatar + ".png?size=32";
}