diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
commit | e1703aea3fd597b23bde90e6c505278c517be611 (patch) | |
tree | 37d98fc90c9cd0844388bfb79beda2204f44af92 /discord/sticker.cpp | |
parent | fd53a76bf6f53a095a639765923a30f2206b2cd6 (diff) | |
parent | e02107feea8214a045e6faa969f00dcbc0d2b072 (diff) | |
download | abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.tar.gz abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.zip |
merge master
Diffstat (limited to 'discord/sticker.cpp')
-rw-r--r-- | discord/sticker.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/discord/sticker.cpp b/discord/sticker.cpp deleted file mode 100644 index b92d031..0000000 --- a/discord/sticker.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "sticker.hpp" - -void to_json(nlohmann::json &j, const StickerData &m) { - j["id"] = m.ID; - j["pack_id"] = m.PackID; - j["name"] = m.Name; - j["description"] = m.Description; - JS_IF("tags", m.Tags); - JS_IF("asset", m.AssetHash); - JS_IF("preview_asset", m.PreviewAssetHash); - j["format_type"] = m.FormatType; -} - -void from_json(const nlohmann::json &j, StickerData &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_O("asset", m.AssetHash); - JS_ON("preview_asset", m.PreviewAssetHash); - JS_D("format_type", m.FormatType); -} - -std::string StickerData::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 ""; -} - -void to_json(nlohmann::json &j, const StickerItem &m) { - j["id"] = m.ID; - j["name"] = m.Name; - j["format_type"] = m.FormatType; -} - -void from_json(const nlohmann::json &j, StickerItem &m) { - JS_D("id", m.ID); - JS_D("name", m.Name); - JS_D("format_type", m.FormatType); -} - -std::string StickerItem::GetURL() const { - if (FormatType == StickerFormatType::PNG || FormatType == StickerFormatType::APNG) - return "https://media.discordapp.net/stickers/" + std::to_string(ID) + ".png?size=256"; - else if (FormatType == StickerFormatType::LOTTIE) - return "https://media.discordapp.net/stickers/" + std::to_string(ID) + ".json"; - return ""; -} |