From 25b56fb4068644cf1c2ea240d1a542aeffaf0736 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Thu, 9 Jan 2025 15:34:00 +0800 Subject: [PATCH] Add support to check if commenting is restricted on Fanbox posts --- src/fanbox/post.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fanbox/post.rs b/src/fanbox/post.rs index 8aafe3d..5b18543 100644 --- a/src/fanbox/post.rs +++ b/src/fanbox/post.rs @@ -95,6 +95,11 @@ impl FanboxPostArticle { self.data["likeCount"].as_u64() } + #[inline] + pub fn is_commenting_restricted(&self) -> Option { + self.data["isCommentingRestricted"].as_bool() + } + #[inline] /// Create a new instance pub fn new(data: &JsonValue, client: Arc) -> Self { @@ -193,6 +198,7 @@ impl CheckUnknown for FanboxPostArticle { "isPinned"+, "isRestricted"+, "likeCount"+, + "isCommentingRestricted", "nextPost", "prevPost", "publishedDatetime"+, @@ -245,6 +251,7 @@ impl Debug for FanboxPostArticle { .field("is_pinned", &self.is_pinned()) .field("is_restricted", &self.is_restricted()) .field("like_count", &self.like_count()) + .field("is_commenting_restricted", &self.is_commenting_restricted()) .field("next_post", &self.next_post()) .field("prev_post", &self.prev_post()) .field("published_datetime", &self.published_datetime())