Skip to content

Commit

Permalink
Merge pull request #26 from arash77/change-comment
Browse files Browse the repository at this point in the history
Shorten comment_text
  • Loading branch information
arash77 authored May 28, 2024
2 parents fe7325d + de2bfbd commit fc4ac20
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/plugins/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ def create_post(self, content, mentions, hashtags, images, **kwargs):
text = f"{content}{mentions}{hashtags}{_images}"
if self.save_path:
os.makedirs(self.save_path, exist_ok=True)
prefix = (
kwargs.get("file_path", "").replace("/", "-").replace(".md", "")
)
prefix = kwargs.get("file_path", "").replace(".md", "")
file_name = (
f"{self.save_path}/{prefix}_{time.strftime('%Y%m%d-%H%M%S')}.md"
f"{self.save_path}/{prefix.replace('/', '-')}_{time.strftime('%Y%m%d-%H%M%S')}.md"
)
with open(file_name, "w") as f:
f.write(text)
Expand All @@ -43,7 +41,7 @@ def create_post(self, content, mentions, hashtags, images, **kwargs):
"mastodon" in social_media or "bluesky" in social_media
):
pre_comment_text = f"Please note that Mastodon and Bluesky only support up to 4 images in a single post. The first 4 images will be included in the post, and the rest will be ignored.\n"
comment_text = f"File: {kwargs.get('file_path')}\n{pre_comment_text}This is a preview that will be posted to {social_media}:\n\n{text}"
comment_text = f"{pre_comment_text}This is a preview from {prefix.split('/')[-1]} that will be posted to {social_media}:\n\n{text}"
return True, None, comment_text
return True, None
except Exception as e:
Expand Down

0 comments on commit fc4ac20

Please sign in to comment.