diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-02-02 22:27:19 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-02-02 22:27:19 -0500 |
commit | f7845509646b6ddaab7209fac0d8caac77e9aa2c (patch) | |
tree | 1aff88ba59abb86cf2e39377d7f9f35f96c0e05d /src/discord | |
parent | ce238d08e96aafc956b5ecd7cf00796a227c5666 (diff) | |
download | abaddon-portaudio-f7845509646b6ddaab7209fac0d8caac77e9aa2c.tar.gz abaddon-portaudio-f7845509646b6ddaab7209fac0d8caac77e9aa2c.zip |
support channel icons for dms
Diffstat (limited to 'src/discord')
-rw-r--r-- | src/discord/channel.cpp | 8 | ||||
-rw-r--r-- | src/discord/channel.hpp | 2 | ||||
-rw-r--r-- | src/discord/store.cpp | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/discord/channel.cpp b/src/discord/channel.cpp index dcd3b8f..9d47076 100644 --- a/src/discord/channel.cpp +++ b/src/discord/channel.cpp @@ -84,6 +84,14 @@ bool ChannelData::IsCategory() const noexcept { return Type == ChannelType::GUILD_CATEGORY; } +bool ChannelData::HasIcon() const noexcept { + return Icon.has_value(); +} + +std::string ChannelData::GetIconURL() const { + return "https://cdn.discordapp.com/channel-icons/" + std::to_string(ID) + "/" + *Icon + ".png"; +} + std::vector<Snowflake> ChannelData::GetChildIDs() const { return Abaddon::Get().GetDiscordClient().GetChildChannelIDs(ID); } diff --git a/src/discord/channel.hpp b/src/discord/channel.hpp index 4485b0b..89e43a0 100644 --- a/src/discord/channel.hpp +++ b/src/discord/channel.hpp @@ -99,6 +99,8 @@ struct ChannelData { bool IsThread() const noexcept; bool IsJoinedThread() const; bool IsCategory() const noexcept; + bool HasIcon() const noexcept; + std::string GetIconURL() const; std::vector<Snowflake> GetChildIDs() const; std::optional<PermissionOverwrite> GetOverwrite(Snowflake id) const; std::vector<UserData> GetDMRecipients() const; diff --git a/src/discord/store.cpp b/src/discord/store.cpp index e182c70..a5b0c13 100644 --- a/src/discord/store.cpp +++ b/src/discord/store.cpp @@ -646,6 +646,7 @@ std::optional<ChannelData> Store::GetChannel(Snowflake id) const { s->Get(6, r.IsNSFW); s->Get(7, r.LastMessageID); s->Get(10, r.RateLimitPerUser); + s->Get(11, r.Icon); s->Get(12, r.OwnerID); s->Get(14, r.ParentID); if (!s->IsNull(16)) { |