fixed issue not responding to callback updates
This commit is contained in:
@@ -25,15 +25,13 @@ async def telegram_webhook(request: Request):
|
||||
|
||||
update = telebot.types.Update.de_json(json_data)
|
||||
|
||||
# Process the update directly instead of using process_new_updates
|
||||
if update.message:
|
||||
try:
|
||||
# Call your message handlers directly
|
||||
bot.process_new_updates([update])
|
||||
except Exception as e:
|
||||
logger.error(f"Error processing update: {e}")
|
||||
# Still return 200 to Telegram to acknowledge receipt
|
||||
return JSONResponse(content={"ok": True}, status_code=200)
|
||||
# Process ALL types of updates (messages, callback queries, etc.)
|
||||
try:
|
||||
bot.process_new_updates([update])
|
||||
except Exception as e:
|
||||
logger.error(f"Error processing update: {e}")
|
||||
# Still return 200 to Telegram to acknowledge receipt
|
||||
return JSONResponse(content={"ok": True}, status_code=200)
|
||||
|
||||
return JSONResponse(content={"ok": True}, status_code=200)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user