diff --git a/app/bot/handlers.py b/app/bot/handlers.py
index fbc1274..d20af02 100644
--- a/app/bot/handlers.py
+++ b/app/bot/handlers.py
@@ -4,6 +4,7 @@
wiring lives in bot/main.py.
"""
+from html import escape
from typing import Any
import structlog
@@ -71,14 +72,15 @@ async def subscribe(session: Any, settings: Settings, telegram_user_id: int) ->
intro = "🔑 Your new API key" if created else "🔑 Your API key (rotated)"
return (
f"{intro} — save it securely; it's shown only once:\n\n"
- f"`{raw_key}`\n\n"
- "*📡 Supported platforms:*\n"
+ f"`{raw_key}`\n\n"
+ "📡 Supported platforms:\n"
"• Telegram\n"
"• Slack\n"
"• Discord\n"
"• Custom Webhooks\n\n"
- f"⚙️ Configure them here: [here]({link})\n\n"
- "*🚀 Send notifications:*\n"
- f"• Endpoint: `{base_url}/api/v1/notify`\n"
- "• Header: `X-API-Key`"
+ f"⚙️ Configure them here: "
+ f'here\n\n'
+ "🚀 Send notifications:\n"
+ f"• Endpoint: `{{base}}/api/v1/notify`\n"
+ "• Header: `X-API-Key`"
)
diff --git a/app/bot/main.py b/app/bot/main.py
index 3bb01b5..57fbecb 100644
--- a/app/bot/main.py
+++ b/app/bot/main.py
@@ -19,11 +19,11 @@ def _msg(update: Update) -> Any:
async def _cmd_start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
- await _msg(update).reply_text(WELCOME, parse_mode=ParseMode.MARKDOWN_V2)
+ await _msg(update).reply_text(WELCOME, parse_mode=ParseMode.HTML)
async def _cmd_help(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
- await _msg(update).reply_text(HELP, parse_mode=ParseMode.MARKDOWN_V2)
+ await _msg(update).reply_text(HELP, parse_mode=ParseMode.HTML)
async def _cmd_subscribe(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
@@ -32,7 +32,7 @@ async def _cmd_subscribe(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
async with SessionLocal() as session:
text = await subscribe(session, settings, telegram_user_id)
await session.commit()
- await _msg(update).reply_text(text, parse_mode=ParseMode.MARKDOWN_V2)
+ await _msg(update).reply_text(text, parse_mode=ParseMode.HTML)
def create_application() -> Application:
diff --git a/tests/test_bot_handlers.py b/tests/test_bot_handlers.py
index 576e1d2..a5de481 100644
--- a/tests/test_bot_handlers.py
+++ b/tests/test_bot_handlers.py
@@ -50,7 +50,7 @@ async def _run() -> str:
text = anyio.run(_run)
assert "Your new API key" in text
- assert "`rn_" in text
+ assert "rn_" in text
assert "rapid.example/api/channels/entry/" in text
async def _check() -> m.User | None:
@@ -63,7 +63,7 @@ async def _check() -> m.User | None:
assert isinstance(user, m.User)
assert len(user.api_key_hash) == 64
# exactly one key occurrence (shown once)
- assert len(re.findall(r"`rn_[^`]+`", text)) == 1
+ assert len(re.findall(r"rn_[^<]+", text)) == 1
def test_subscribe_again_rotates_key(tmp_path) -> None:
@@ -78,8 +78,8 @@ async def _run(subscribe_id: int) -> str:
first = anyio.run(_run, 888)
second = anyio.run(_run, 888)
assert "rotated" in second
- raw_first = re.search(r"`(rn_[^`]+)`", first).group(1)
- raw_second = re.search(r"`(rn_[^`]+)`", second).group(1)
+ raw_first = re.search(r"(rn_[^<]+)", first).group(1)
+ raw_second = re.search(r"(rn_[^<]+)", second).group(1)
assert raw_first != raw_second
async def _count() -> int: