From 1d488dcb140affb7d14b5f936a98bbf0349ee2ad Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 17 Apr 2025 15:42:45 -0700 Subject: truncate post content if its longer than 3000 chars --- rasis.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'rasis.py') diff --git a/rasis.py b/rasis.py index ea253ff..c5bcba4 100644 --- a/rasis.py +++ b/rasis.py @@ -95,7 +95,11 @@ def generate_post_content(post_data: dict) -> str: content = content + f"[{post_data['type']}] " if post_data["headline"] is not None and post_data["headline"] != post_data["content"] : content = content + f"[{post_data['headline']}]\n\n" - content = content + post_data["content"] + "\n\n" + if len(post_data["content"]) > 3000: + truncated_content = post_data["content"][:3000] + "..." + content = content + truncated_content + "\n\n" + else: + content = content + post_data["content"] + "\n\n" if post_data["url"] is not None: content = content + f"🔗 {post_data['url']}\n" for i in range(len(post_data["images"])): -- cgit v1.2.3