Skip to content

Commit

Permalink
Add message formatter (#20)
Browse files Browse the repository at this point in the history
Add message formater
  • Loading branch information
juanitodread committed Mar 15, 2024
1 parent e034450 commit 4fa257f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pierrot/src/pierrot.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ def publish_photo(self) -> None:

try:
twitter_photo_id = self._twitter.upload_photo(photo_file_name)
self._twitter.publish_tweet(twitter_photo_id, self._twitter._config.tweet_text)
self._twitter.publish_tweet(twitter_photo_id, self._format_message(self._twitter._config.tweet_text))
except PierrotExeception as error:
log.error(f'Failed publishing photo to Twitter: {error}')
return

log.info(f'Photo published to Twitter: photo_url={unpublished_photo["url"]}')

def _format_message(self, message: str) -> str:
return message.replace('~', '\n')

0 comments on commit 4fa257f

Please sign in to comment.