diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-11-02 17:36:10 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-11-02 17:36:10 -0500 |
commit | b97722e93775d8778400d42f30299d55682906f1 (patch) | |
tree | e497d0aafa7719208c219d88fc5e3901965be9a9 /discord/sticker.cpp | |
parent | 8efa2024582b0a2aeda72f3e6865a4562717eabc (diff) | |
download | abaddon-portaudio-b97722e93775d8778400d42f30299d55682906f1.tar.gz abaddon-portaudio-b97722e93775d8778400d42f30299d55682906f1.zip |
show non-lottie stickers statically
Diffstat (limited to 'discord/sticker.cpp')
-rw-r--r-- | discord/sticker.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/discord/sticker.cpp b/discord/sticker.cpp new file mode 100644 index 0000000..1d59e82 --- /dev/null +++ b/discord/sticker.cpp @@ -0,0 +1,21 @@ +#include "sticker.hpp" + +void from_json(const nlohmann::json &j, Sticker &m) { + JS_D("id", m.ID); + JS_D("pack_id", m.PackID); + JS_D("name", m.Name); + JS_D("description", m.Description); + JS_O("tags", m.Tags); + JS_D("asset", m.AssetHash); + JS_N("preview_asset", m.PreviewAssetHash); + JS_D("format_type", m.FormatType); +} + +std::string Sticker::GetURL() const { + if (!AssetHash.has_value()) return ""; + if (FormatType == StickerFormatType::PNG || FormatType == StickerFormatType::APNG) + return "https://media.discordapp.net/stickers/" + std::to_string(ID) + "/" + *AssetHash + ".png?size=256"; + else if (FormatType == StickerFormatType::LOTTIE) + return "https://media.discordapp.net/stickers/" + std::to_string(ID) + "/" + *AssetHash + ".json"; + return ""; +} |