fix(app): Add title to mastodon post

This commit is contained in:
2025-06-01 13:49:25 +02:00
parent 17357da659
commit 8f5813b39c

View File

@ -137,8 +137,12 @@ def save_seen_id(post_id):
f.write(post_id + "\n")
def post_to_mastodon(message):
def post_to_mastodon(title, link, tags):
mastodon = Mastodon(access_token=MASTODON_TOKEN, api_base_url=MASTODON_BASE_URL)
hashtags = " ".join(f"#{tag}" for tag in tags) if tags else ""
message = f"{title}\n\n{link}"
if hashtags:
message += f"\n\n{hashtags}"
mastodon.toot(message)
@ -257,7 +261,7 @@ def main():
try:
if POST_TARGETS in ("mastodon", "both"):
post_to_mastodon(message)
post_to_mastodon(title, link, tags)
time.sleep(2)
if POST_TARGETS in ("bluesky", "both"):