diff --git a/app/bot.py b/app/bot.py index 4ebbe9d..58f87b8 100644 --- a/app/bot.py +++ b/app/bot.py @@ -109,10 +109,14 @@ async def user_start(update: Update, context): async def handle_user_message(update: Update, context): - """Receive text → TTS → reply voice → forward to admin.""" + """Receive text/caption → TTS → reply voice → forward to admin.""" global admin_chat_id user = update.effective_user - text = update.message.text + text = update.message.text or update.message.caption + + if not text: + # Media without caption — silently ignore + return logger.info(f"User {user.full_name} (id={user.id}): {text[:80]}") @@ -183,7 +187,7 @@ def build_admin_app() -> Application: def build_user_app() -> Application: app = Application.builder().token(USER_TOKEN).build() app.add_handler(CommandHandler('start', user_start)) - app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_user_message)) + app.add_handler(MessageHandler((filters.TEXT | filters.CAPTION) & ~filters.COMMAND, handle_user_message)) return app