mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Исправление уведомления
This commit is contained in:
@@ -25,13 +25,14 @@ def format_request_message(request_data: dict) -> str:
|
||||
status = STATUS_LABELS.get(request_data.get("status", "new"), "Неизвестно")
|
||||
|
||||
return (
|
||||
f"📋 <b>Заявка #{request_data['id']}</b>\n\n"
|
||||
f"👤 <b>Сотрудник:</b> {request_data['employee_last_name']} {request_data['employee_first_name']}\n"
|
||||
f"🏢 <b>Отдел:</b> {department}\n"
|
||||
f"🚪 <b>Кабинет:</b> {request_data['office']}\n"
|
||||
f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} <b>Тип заявки:</b> {request_type}\n"
|
||||
f"{PRIORITY_EMOJI.get(request_data['priority'], '⚪')} <b>Приоритет:</b> {priority}\n\n"
|
||||
f"📝 <b>Описание:</b>\n<blockquote>{request_data['description']}</blockquote>\n\n"
|
||||
f"🕒 <b>Создана:</b> {created_at}\n"
|
||||
f"📊 <b>Статус:</b> {status}"
|
||||
f"📋 Заявка #{request_data['id']}\n\n"
|
||||
f"👤 Сотрудник: {request_data['employee_last_name']} {request_data['employee_first_name']}\n"
|
||||
f"🏢 Отдел: {department}\n"
|
||||
f"🚪 Кабинет: {request_data['office']}\n"
|
||||
f"{REQUEST_TYPE_EMOJI.get(request_data['request_type'], '📝')} Тип заявки: {request_type}\n"
|
||||
f"{PRIORITY_EMOJI.get(request_data['priority'], '⚪')} Приоритет: {priority}\n\n"
|
||||
f"📝 Описание:\n{request_data['description']}\n\n"
|
||||
f"🕒 Создана: {created_at}\n"
|
||||
f"📊 Статус: {status}"
|
||||
)
|
||||
|
||||
|
@@ -2,22 +2,16 @@
|
||||
from .config import settings
|
||||
from . import bot
|
||||
from .handlers import get_updated_keyboard
|
||||
|
||||
from .messages import format_request_message
|
||||
async def send_notification(request_data: dict):
|
||||
"""Send notification about new request to Telegram chat"""
|
||||
message_text = (
|
||||
f"Новая заявка №{request_data['id']}\n"
|
||||
f"Отдел: {request_data['department']}\n"
|
||||
f"Тип: {request_data['request_type']}\n"
|
||||
f"Приоритет: {request_data['priority']}\n"
|
||||
f"Описание: {request_data['description']}"
|
||||
)
|
||||
|
||||
try:
|
||||
message_text = format_request_message(request_data)
|
||||
await bot.send_message(
|
||||
chat_id=settings.chat_id,
|
||||
text=message_text,
|
||||
parse_mode="HTML",
|
||||
reply_markup=get_updated_keyboard(request_data['id'], "new")
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Error sending notification: {e}")
|
||||
print(f"Error sending notification: {e}")
|
||||
|
Reference in New Issue
Block a user