Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update social media assistant message #41

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/galaxy_social.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def process_markdown_file(self, file_path, processed_files):
except Exception as e:
raise Exception(f"Failed to format post for {file_path}.\n{e}")
if self.preview:
message = f'Hi, I\'m your friendly social media assistant. In the following, you will see a preview of this post "{file_path}"'
message = f"👋 Hello! I'm your friendly social media assistant. Below are the previews of this post:\n`{file_path}`"
for media in metadata["media"]:
formatted_content, preview, warning = formatting_results[media]
message += f"\n\n## {media}\n\n"
Expand All @@ -130,10 +130,8 @@ def process_markdown_file(self, file_path, processed_files):
message += f"\nWARNING: {warning}"
return processed_files, message.strip()

stats = {}
url = {}
if file_path in processed_files:
stats = processed_files[file_path]
stats = processed_files[file_path] if file_path in processed_files else {}
for media in metadata["media"]:
if stats.get(media):
print("Skipping previous post to", media)
Expand All @@ -149,7 +147,11 @@ def process_markdown_file(self, file_path, processed_files):
if stats[media]
]
)
message = f"Posted to:\n\n{url_text}" if url_text else "No posts created."
message = (
f"Below are the links of this post:\n`{file_path}`\n\n{url_text}"
if url_text
else f"Nothing created for this post:\n`{file_path}`"
)

processed_files[file_path] = stats
print(f"Processed {file_path}: {stats}")
Expand Down