Skip to content

Commit

Permalink
Add error log with reason when we skip posting a highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmaJonse committed Nov 11, 2023
1 parent ce254db commit 5bf679c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/command/post_highlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from src.command.command import Command, Priority
from src.data.highlight import Highlight
from src.logger import log
from src.output import output

class PostHighlight(Command):
Expand All @@ -24,7 +25,17 @@ def execute(self) -> None:
"""
text : Optional[str] = self.highlight.get_post()
footer : Optional[str] = self.highlight.get_footer()
if (text is not None and
footer is not None and
not output.has_posted_today(footer.strip())):
output.post_with_media(text, self.highlight.video)

if text is None:
log.error("Could not post highlight - no post text.")
return

if footer is None:
log.error("Could not post highlight - no footer text")
return

if output.has_posted_today(footer.strip()):
log.error("Could not post highlight - duplicate post")
return

output.post_with_media(text, self.highlight.video)

0 comments on commit 5bf679c

Please sign in to comment.