I want bot to check if user answer have audio and then decide what to do but bot only handle text message and just ignores audio.
I have this handler
async def self_problem(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
conn = sqlite3.connect(database='db.db')
cur = conn.cursor()
Then here new should be check if message have text ot not(because audio should do not have text i believe), but bit just ignores if I send audio-message and will only reply after text message
if update.message.text:
query = f"update users set problem = '{update.message.text}' where id = {context.user_data['user_id']}"
else:
audio_file = update.message.audio
new_file = await context.bot.get_file(audio_file.file_id)
audio_path = f'audio/{audio_file.file_unique_id}.ogg'
await new_file.download(audio_path)
query = f"insert into audio ('id', 'audio_name') values ({context.user_data['user_id']}, '{audio_path}')"
cur.execute(query)
conn.commit()
query = f"update users set problem = 'в аудио-сообщении' where id = {context.user_data['user_id']}"
cur.execute(query)
conn.commit()
print(query, 'executed', sep='n')
conn.close()
await context.bot.send_video(chat_id=update.effective_chat.id, video=video_for_11)
await context.bot.send_video(chat_id=update.effective_chat.id, video=video_end)
return await before_reg_or_num(update, context)
And this in ConversationHandler
SELF_PROBLEM: [MessageHandler(filters.TEXT | filters.AUDIO, self_problem)],
I didnt found any handler to handle audio thus I just did filters.AUDIO