init commit

This commit is contained in:
2025-08-17 11:44:54 +09:00
commit 5592014530
59 changed files with 3175 additions and 0 deletions

19
app/services/telegram.py Normal file
View File

@@ -0,0 +1,19 @@
from typing import Iterable
def make_keyboard_payload(buttons: Iterable[tuple[str, str]] | None):
if not buttons:
return None
rows = [[{"text": t, "url": u}] for t, u in buttons]
return {"rows": rows}
def build_payload(ptype: str, text: str | None, media_file_id: str | None,
parse_mode: str | None, keyboard: dict | None) -> dict:
# ptype: "text" | "photo" | "video" | "animation"
return {
"type": ptype,
"text": text,
"media_file_id": media_file_id,
"parse_mode": parse_mode,
"keyboard": keyboard,
}