diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-04-14 00:11:39 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-04-14 00:11:39 -0400 |
commit | 34f8af599d76c74b719821e92d60937d9dcc01e3 (patch) | |
tree | 3feca6e98ea685d88b591e3ddc07f0fba8e59a18 /src/discord/channel.cpp | |
parent | d36fe4d0e9f7e537adc73827b925c429cd1f6ba8 (diff) | |
download | abaddon-portaudio-34f8af599d76c74b719821e92d60937d9dcc01e3.tar.gz abaddon-portaudio-34f8af599d76c74b719821e92d60937d9dcc01e3.zip |
fix tab titles
Diffstat (limited to 'src/discord/channel.cpp')
-rw-r--r-- | src/discord/channel.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/discord/channel.cpp b/src/discord/channel.cpp index 0770581..6277341 100644 --- a/src/discord/channel.cpp +++ b/src/discord/channel.cpp @@ -92,6 +92,19 @@ std::string ChannelData::GetIconURL() const { return "https://cdn.discordapp.com/channel-icons/" + std::to_string(ID) + "/" + *Icon + ".png"; } +std::string ChannelData::GetDisplayName() const { + if (Name.has_value()) { + return "#" + *Name; + } else { + const auto recipients = GetDMRecipients(); + if (Type == ChannelType::DM && !recipients.empty()) + return recipients[0].Username; + else if (Type == ChannelType::GROUP_DM) + return std::to_string(recipients.size()) + " members"; + } + return "Unknown"; +} + std::vector<Snowflake> ChannelData::GetChildIDs() const { return Abaddon::Get().GetDiscordClient().GetChildChannelIDs(ID); } |