Skip to content

Commit

Permalink
Update bot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
LLIo6oH authored Nov 30, 2024
1 parent 059a9cb commit 8917d2d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ async def handle_booking(message: Message):
# Вебхук
async def handle_webhook(request):
"""Обрабатывает запросы от Telegram через вебхук."""
data = await request.json()
update = Update.to_object(data)
await dp.feed_update(bot, update)
try:
data = await request.json()
update = Update(**data) # Преобразуем JSON в объект Update
await dp.feed_update(bot, update) # Передаем обновление в диспетчер
except Exception as e:
print(f"Ошибка обработки вебхука: {e}")
return web.Response()

async def main():
Expand Down

0 comments on commit 8917d2d

Please sign in to comment.