Просмотр исходного кода

Gate chat send on send_ready(); remove hardcoded booking guard

ZiB 4 месяцев назад
Родитель
Сommit
9625ab42f7
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      room_cal/api/_routes/chat.py

+ 2 - 2
room_cal/api/_routes/chat.py

@@ -65,9 +65,9 @@ async def get_thread(service_key: str, chat_id: str):
 
 @router.post('/chat/{service_key}/{chat_id}', status_code=204)
 async def send_message(service_key: str, chat_id: str, payload: _SendBody):
-  if service_key == 'booking':
-    raise HTTPException(501, 'Booking.com send_message is temporarily disabled pending API debugging')
   client = _get_chat_client(service_key)
+  if not client.send_ready():
+    raise HTTPException(503, f'{service_key!r} chat sending is not available')
   try:
     await client.send_message(chat_id, payload.body)
   except ServiceAuthError as e: