diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-05-11 15:05:32 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-05-11 15:05:32 -0400 |
commit | 8b488a5ca9036caf17ecee000cca6a7eba94d28a (patch) | |
tree | e4f41ab0c22403a91f6d54630ede2f9bee608a17 /src/discord/channel.cpp | |
parent | 1d8ef79da68a89c4561b9079b795d05484ddc419 (diff) | |
download | abaddon-portaudio-8b488a5ca9036caf17ecee000cca6a7eba94d28a.tar.gz abaddon-portaudio-8b488a5ca9036caf17ecee000cca6a7eba94d28a.zip |
add icons to dms
Diffstat (limited to 'src/discord/channel.cpp')
-rw-r--r-- | src/discord/channel.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/discord/channel.cpp b/src/discord/channel.cpp index 6277341..498b2e5 100644 --- a/src/discord/channel.cpp +++ b/src/discord/channel.cpp @@ -89,7 +89,15 @@ bool ChannelData::HasIcon() const noexcept { } std::string ChannelData::GetIconURL() const { - return "https://cdn.discordapp.com/channel-icons/" + std::to_string(ID) + "/" + *Icon + ".png"; + if (HasIcon()) { + return "https://cdn.discordapp.com/channel-icons/" + std::to_string(ID) + "/" + *Icon + ".png"; + } else { + const auto recipients = GetDMRecipients(); + if (!recipients.empty()) + return recipients[0].GetAvatarURL("png", "32"); + else + return "https://cdn.discordapp.com/embed/avatars/0.png"; + } } std::string ChannelData::GetDisplayName() const { |