update sign up notifications
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 9s
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 9s
This commit is contained in:
+20
@@ -70,6 +70,26 @@ async def send_telegram_alert(markdown_message: str):
|
||||
)
|
||||
|
||||
|
||||
async def send_telegram_photo(photo, markdown_caption: str):
|
||||
"""Send a photo. `photo` may be raw bytes / a file-like object (uploaded
|
||||
directly to Telegram) or a public URL string."""
|
||||
logger.info("[TELEGRAM] Preparing to send photo...")
|
||||
kwargs = {}
|
||||
if TOPIC_ID:
|
||||
kwargs["message_thread_id"] = int(TOPIC_ID)
|
||||
await bot.send_photo(
|
||||
chat_id=str(CHAT_ID),
|
||||
photo=photo,
|
||||
caption=markdown_caption,
|
||||
parse_mode=ParseMode.MARKDOWN_V2,
|
||||
# Uploading media is slower than a text send; the defaults (5s) time out.
|
||||
connect_timeout=15,
|
||||
read_timeout=30,
|
||||
write_timeout=60,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
def escape_markdown_v2(text: str) -> str:
|
||||
escape_chars = r"_~`>#+-=|{}.!\\"
|
||||
return re.sub(f"([{re.escape(escape_chars)}])", r"\\\1", text)
|
||||
|
||||
Reference in New Issue
Block a user