Skip to content

Commit 5ea1524

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 358eb58 + 24360ab commit 5ea1524

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/scripts/send_release_to_telegram.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import asyncio
21
import os
2+
import asyncio
3+
34
from telegram import Bot, LinkPreviewOptions
45

56

@@ -34,14 +35,17 @@ def format_release_message(tag_name: str, name: str, body: str) -> str:
3435
elif line.startswith("> Update with pip:"):
3536
pip_command = line.split("`")[1]
3637
elif line.startswith("-"):
37-
line = line.replace("[", r"\[")
38+
line = line.replace("[", "\\[").replace("]", "\\]")
3839
formatted_parts.append(f"• {line[1:]}")
3940

4041
if pip_command:
4142
formatted_parts.append(f"\n>> Update with:\n```bash\n{pip_command}\n```")
4243

4344
message_body = "\n".join(formatted_parts)
4445

46+
# Remove redundant escape characters
47+
message_body = message_body.replace("\\[", "[").replace("\\]", "]")
48+
4549
formatted_message = (
4650
f"🎉 **NEW VERSION • {name}**\n\n"
4751
f"📝 [Changelog](https://github.com/david-lev/pywa/releases/tag/{tag_name})\n\n"
@@ -59,6 +63,7 @@ async def send_to_telegram():
5963
release_body = os.getenv("RELEASE_BODY")
6064

6165
message = format_release_message(release_tag, release_name, release_body)
66+
print(message)
6267

6368
bot = Bot(token=bot_token)
6469
await bot.send_message(

0 commit comments

Comments
 (0)