From f3d8af5a3a6834e7ace554d451d2e0298ac343dd Mon Sep 17 00:00:00 2001 From: PatatjeMC Date: Tue, 7 Jun 2022 20:50:32 +0200 Subject: [PATCH] Block stickied comments from being used this blocks stickied comments from being used because this is mostly used for bot messages and not about the actual thread. --- reddit/subreddit.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index c7ac06d..d8c68bf 100755 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -58,10 +58,11 @@ def get_subreddit_threads(): content["comments"] = [] for top_level_comment in submission.comments: - if len(top_level_comment.body) <= int(environ["MAX_COMMENT_LENGTH"]): - content["comments"].append( - {"comment_body": top_level_comment.body, "comment_url": top_level_comment.permalink, - "comment_id": top_level_comment.id, }) + if not top_level_comment.stickied: + if len(top_level_comment.body) <= int(environ["MAX_COMMENT_LENGTH"]): + content["comments"].append( + {"comment_body": top_level_comment.body, "comment_url": top_level_comment.permalink, + "comment_id": top_level_comment.id, }) except AttributeError as e: pass