summaryrefslogtreecommitdiff
path: root/src/discord/channel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/discord/channel.cpp')
-rw-r--r--src/discord/channel.cpp13
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);
}