Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Commit

Permalink
fix(media): skip post sync without text nor media (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset authored Oct 20, 2023
1 parent dd66d35 commit 89ed2ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/services/bluesky-sender.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export const blueskySenderService = async (client: BskyAgent | null, post: Blues
}
}

// When no compatible media has been found and no text is present, skip the post
if(!mediaAttachments.length && !post.tweet.text) {
log.warn(`☁️ | post skipped: no compatible media nor text to post (tweet: ${post.tweet.id})`);
return;
}

// Data creation
const data: {
[x: string]: unknown
Expand Down
6 changes: 6 additions & 0 deletions src/services/mastodon-sender.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export const mastodonSenderService = async (client: mastodon.rest.Client | null,
}
}

// When no compatible media has been found and no text is present, skip the post
if(!mediaAttachments.length && !post.tweet.text) {
log.warn(`🦣️ | post skipped: no compatible media nor text to post (tweet: ${post.tweet.id})`);
return;
}

log.text = `🦣 | toot sending: ${getPostExcerpt(post.tweet.text ?? VOID)}`;

// Post
Expand Down

0 comments on commit 89ed2ef

Please sign in to comment.