support channel icons for dms

This commit is contained in:
ouwou
2022-02-02 22:27:19 -05:00
parent ce238d08e9
commit f784550964
4 changed files with 18 additions and 1 deletions

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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)) {