summaryrefslogtreecommitdiff
path: root/discord/channel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'discord/channel.cpp')
-rw-r--r--discord/channel.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/discord/channel.cpp b/discord/channel.cpp
index 9d90eb5..60f481b 100644
--- a/discord/channel.cpp
+++ b/discord/channel.cpp
@@ -1,6 +1,20 @@
#include "../abaddon.hpp"
#include "channel.hpp"
+void from_json(const nlohmann::json &j, ThreadMetadataData &m) {
+ JS_D("archived", m.IsArchived);
+ JS_D("auto_archive_duration", m.AutoArchiveDuration);
+ JS_D("archive_timestamp", m.ArchiveTimestamp);
+ JS_O("locked", m.IsLocked);
+}
+
+void from_json(const nlohmann::json &j, ThreadMemberObject &m) {
+ JS_O("id", m.ThreadID);
+ JS_O("user_id", m.UserID);
+ JS_D("join_timestamp", m.JoinTimestamp);
+ JS_D("flags", m.Flags);
+}
+
void from_json(const nlohmann::json &j, ChannelData &m) {
JS_D("id", m.ID);
JS_D("type", m.Type);
@@ -21,6 +35,8 @@ void from_json(const nlohmann::json &j, ChannelData &m) {
JS_O("application_id", m.ApplicationID);
JS_ON("parent_id", m.ParentID);
JS_ON("last_pin_timestamp", m.LastPinTimestamp);
+ JS_O("thread_metadata", m.ThreadMetadata);
+ JS_O("member", m.ThreadMember);
}
void ChannelData::update_from_json(const nlohmann::json &j) {
@@ -47,6 +63,16 @@ bool ChannelData::NSFW() const {
return IsNSFW.has_value() && *IsNSFW;
}
+bool ChannelData::IsThread() const noexcept {
+ return Type == ChannelType::GUILD_PUBLIC_THREAD ||
+ Type == ChannelType::GUILD_PRIVATE_THREAD ||
+ Type == ChannelType::GUILD_NEWS_THREAD;
+}
+
+bool ChannelData::IsJoinedThread() const {
+ return Abaddon::Get().GetDiscordClient().IsThreadJoined(ID);
+}
+
std::optional<PermissionOverwrite> ChannelData::GetOverwrite(Snowflake id) const {
return Abaddon::Get().GetDiscordClient().GetPermissionOverwrite(ID, id);
}