add formating

This commit is contained in:
kandrusyak
2026-07-27 17:14:07 +03:00
parent 7b7ff51d0f
commit 275eca8dc5
10 changed files with 628 additions and 157 deletions

View File

@@ -7,6 +7,7 @@ from telegram.ext import Application
from .config import REMINDER_POLL_SECONDS
from .storage import AssistantStorage
from .telegram_utils import escape_markdown_text, markdown_code, send_markdown
from .time_utils import format_local_dt, utc_now
@@ -21,12 +22,15 @@ async def reminder_loop(application: Application) -> None:
try:
due_reminders = storage.due_reminders(utc_now())
for reminder in due_reminders:
await application.bot.send_message(
await send_markdown(
application.bot,
chat_id=reminder["chat_id"],
text=(
f"Напоминание #{reminder['id']} "
f"({format_local_dt(reminder['remind_at'], tz)}):\n"
f"{reminder['text']}"
markdown=(
f"**⏰ Напоминание "
f"{markdown_code('#' + str(reminder['id']))}**\n\n"
f"**Время:** "
f"{markdown_code(format_local_dt(reminder['remind_at'], tz))}\n"
f"**Задача:** {escape_markdown_text(reminder['text'])}"
),
)
storage.mark_reminder_sent(int(reminder["id"]))