From 75380a221300cbc164366fdd5ce936eb16999700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Carvalho?= Date: Fri, 4 Oct 2024 11:43:32 -0300 Subject: [PATCH] feat - adding external videos field --- function/schemas.py | 1 + function/telegram/message.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/function/schemas.py b/function/schemas.py index 01d9859..096701d 100644 --- a/function/schemas.py +++ b/function/schemas.py @@ -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] = [] diff --git a/function/telegram/message.py b/function/telegram/message.py index f77acdc..c2ae1a1 100644 --- a/function/telegram/message.py +++ b/function/telegram/message.py @@ -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." @@ -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,