Skip to content

Commit

Permalink
feat - adding external videos field
Browse files Browse the repository at this point in the history
  • Loading branch information
jjpaulo2 committed Oct 4, 2024
1 parent 14de5b3 commit 75380a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions function/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ class Message(BaseModel):
content: list[str] = []
images: list[str] = []
videos: list[str] = []
external_videos: list[str] = []
youtube: list[str] = []
instagram: list[str] = []
12 changes: 11 additions & 1 deletion function/telegram/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def _body(self) -> str:
return text[:TELEGRAM_MAX_CONTENT_SIZE] + " **[...]**"

elif not text.strip():
if self.message.videos:
if self.message.external_videos:
return "Assista o vídeo clicando no botão abaixo."
elif self.message.videos:
return "Assista o vídeo no YouTube clicando no botão abaixo."
elif self.message.instagram:
return "Veja a publicação no Instagram clicando no botão abaixo."
Expand Down Expand Up @@ -114,6 +116,14 @@ def buttons(self) -> InlineKeyboardMarkup:
self._whatsapp_link,
),
]
if self.message.external_videos:
keyboard.insert(
0,
self._button(
emojize(":play_button: Assistir vídeo"),
self.message.external_videos[0],
),
)
if self.message.youtube:
keyboard.insert(
0,
Expand Down

0 comments on commit 75380a2

Please sign in to comment.