48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
from telegram import Bot
|
|
from config import GROUPE_CHANTIER, GROUPE_MAGASINIER, GROUPE_SAV
|
|
|
|
|
|
async def notify_fin_chantier(
|
|
bot: Bot, ouvrier: str, chantier: str, n_photos: int, nc_path: str
|
|
) -> None:
|
|
text = (
|
|
f"✅ Fin de chantier\n"
|
|
f"👷 {ouvrier}\n"
|
|
f"🏠 Chantier : {chantier}\n"
|
|
f"📸 {n_photos} photo(s) archivée(s)\n"
|
|
f"📁 {nc_path}\n"
|
|
f"💶 Tu peux préparer la facture finale."
|
|
)
|
|
await bot.send_message(chat_id=GROUPE_CHANTIER, text=text)
|
|
|
|
|
|
async def notify_sav(
|
|
bot: Bot,
|
|
ouvrier: str,
|
|
chantier: str,
|
|
description: str,
|
|
photo_bytes: bytes | None = None,
|
|
) -> None:
|
|
if not GROUPE_SAV:
|
|
return
|
|
text = (
|
|
f"🚨 Alerte SAV\n"
|
|
f"👷 {ouvrier}\n"
|
|
f"🏠 Chantier : {chantier}\n"
|
|
f"📋 {description}"
|
|
)
|
|
if photo_bytes:
|
|
await bot.send_photo(chat_id=GROUPE_SAV, photo=photo_bytes, caption=text)
|
|
else:
|
|
await bot.send_message(chat_id=GROUPE_SAV, text=text)
|
|
|
|
|
|
async def notify_materiel(bot: Bot, ouvrier: str, chantier: str, liste: str) -> None:
|
|
text = (
|
|
f"📦 Matériel Manquant\n"
|
|
f"👷 {ouvrier}\n"
|
|
f"🏠 Chantier : {chantier}\n"
|
|
f"📋 {liste}"
|
|
)
|
|
await bot.send_message(chat_id=GROUPE_MAGASINIER, text=text)
|