diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-09-13 01:44:43 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-09-13 01:44:43 -0400 |
commit | af85d5c89582176b75d43f3f92cce6aa55d19367 (patch) | |
tree | 44febc0f5dc026572fab9d7a9776bfc202c7b675 /discord/channel.hpp | |
parent | b01234083001e5b1f5383d6cd4e909e6ca7e58cf (diff) | |
parent | 002004cb5f01d22601047433cc868359cf022842 (diff) | |
download | abaddon-portaudio-af85d5c89582176b75d43f3f92cce6aa55d19367.tar.gz abaddon-portaudio-af85d5c89582176b75d43f3f92cce6aa55d19367.zip |
Merge branch 'threads'
Diffstat (limited to 'discord/channel.hpp')
-rw-r--r-- | discord/channel.hpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/discord/channel.hpp b/discord/channel.hpp index 68597e6..942d555 100644 --- a/discord/channel.hpp +++ b/discord/channel.hpp @@ -15,9 +15,10 @@ enum class ChannelType : int { GUILD_NEWS = 5, GUILD_STORE = 6, /* 7 and 8 were used for LFG */ - /* 9 and 10 were used for threads */ - PUBLIC_THREAD = 11, - PRIVATE_THREAD = 12, + /* 9 was used for threads */ + GUILD_NEWS_THREAD = 10, + GUILD_PUBLIC_THREAD = 11, + GUILD_PRIVATE_THREAD = 12, GUILD_STAGE_VOICE = 13, }; @@ -37,6 +38,26 @@ constexpr const char *GetStagePrivacyDisplayString(StagePrivacy e) { } } +// should be moved somewhere? + +struct ThreadMetadataData { + bool IsArchived; + int AutoArchiveDuration; + std::string ArchiveTimestamp; + std::optional<bool> IsLocked; + + friend void from_json(const nlohmann::json &j, ThreadMetadataData &m); +}; + +struct ThreadMemberObject { + std::optional<Snowflake> ThreadID; + std::optional<Snowflake> UserID; + std::string JoinTimestamp; + int Flags; + + friend void from_json(const nlohmann::json &j, ThreadMemberObject &m); +}; + struct ChannelData { Snowflake ID; ChannelType Type; @@ -57,11 +78,15 @@ struct ChannelData { std::optional<Snowflake> ApplicationID; std::optional<Snowflake> ParentID; // null std::optional<std::string> LastPinTimestamp; // null + std::optional<ThreadMetadataData> ThreadMetadata; + std::optional<ThreadMemberObject> ThreadMember; friend void from_json(const nlohmann::json &j, ChannelData &m); void update_from_json(const nlohmann::json &j); bool NSFW() const; + bool IsThread() const noexcept; + bool IsJoinedThread() const; std::optional<PermissionOverwrite> GetOverwrite(Snowflake id) const; std::vector<UserData> GetDMRecipients() const; }; |