Skip to content

Commit

Permalink
fix - whatsapp link
Browse files Browse the repository at this point in the history
  • Loading branch information
jjpaulo2 committed Oct 2, 2024
1 parent 4feb60b commit a652078
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion function/telegram/message.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from urllib.parse import quote_plus

from emoji import emojize
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, InputMediaPhoto

from function.settings import (
TELEGRAM_MAX_ALBUM_QUANTITY,
TELEGRAM_MAX_CONTENT_SIZE,
WHATSAPP_LINK_FOR_CHANNEL,
WHATSAPP_LINK_TEMPLATE,
)
from function.app import Message
from function.utils import get_domain, join_lines
Expand Down Expand Up @@ -46,7 +49,7 @@ def _body(self) -> str:
return text

@property
def _whatsapp_link(self) -> str:
def _whatsapp_link_text(self) -> str:
return join_lines(
self._title.replace("**", "*"),
f"*Fonte:* {self._link}",
Expand All @@ -55,6 +58,10 @@ def _whatsapp_link(self) -> str:
'e receba notícias como esta em primeira mão no seu Telegram!',
)

@property
def _whatsapp_link(self) -> str:
return WHATSAPP_LINK_TEMPLATE.format(text=quote_plus(self._whatsapp_link_text))

def _button(self, text: str, link: str) -> list[InlineKeyboardButton]:
return [InlineKeyboardButton(text=text, url=link)]

Expand Down

0 comments on commit a652078

Please sign in to comment.