2506minecraft commited on
Commit
ace34fb
·
verified ·
1 Parent(s): ad5142e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -117,6 +117,10 @@ async def process_voice(update: Update, context):
117
  await voice_file.download_to_drive("user_voice.ogg")
118
 
119
  user_text = await speech_to_text("user_voice.ogg")
 
 
 
 
120
  bot_response = await generate_response(user_text, str(user_id))
121
  await text_to_speech(bot_response)
122
 
 
117
  await voice_file.download_to_drive("user_voice.ogg")
118
 
119
  user_text = await speech_to_text("user_voice.ogg")
120
+ if not user_text:
121
+ await update.message.reply_text("لم أتمكن من فهم الصوت. يرجى المحاولة مرة أخرى.")
122
+ return
123
+
124
  bot_response = await generate_response(user_text, str(user_id))
125
  await text_to_speech(bot_response)
126