3

How can I make aiogram bot reply to an audio message? I have already tried this:

if message.Audio.duration <= 60:
    await message.reply("message")
Mureek
  • 33
  • 3

1 Answers1

1
@dp.message_handler(content_types=types.ContentTypes.VOICE | types.ContentTypes.AUDIO)
async def audio_message_handler(msg: types.Message):
    if msg.content_type == "voice":
        await msg.reply("Voice message")
    elif msg.content_type == "audio":
        await msg.reply("Audio message")
Zhymabek Roman
  • 35
  • 2
  • 11