From 282d02d00077ea92dc209ca74a34a53ca5adf677 Mon Sep 17 00:00:00 2001 From: Bhupesh-V Date: Thu, 15 Aug 2024 16:21:34 +0530 Subject: [PATCH] dont message if empty use --- community-threads/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/community-threads/main.py b/community-threads/main.py index c23759a..6e1e7a6 100644 --- a/community-threads/main.py +++ b/community-threads/main.py @@ -154,8 +154,12 @@ def main(): update_gist(gist_id, "collection.json", json.dumps(collection_json, indent=4)) print("Internal database updated successfully!") update_wiki(reddit, "community-threads", posts) - send_message(reddit, new_post["author"], new_post["url"]) - print("Message sent to the author!") + if new_post["author"]: + send_message(reddit, new_post["author"], new_post["url"]) + print("Message sent to the author!") + else: + print("Author username is empty. No message sent.") + else: print("Post is already in the collection. No changes were made.")