Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make bot reply to an audio message?

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")
like image 507
Mureek Avatar asked Sep 19 '25 16:09

Mureek


1 Answers

@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")
like image 113
Zhymabek Roman Avatar answered Sep 21 '25 05:09

Zhymabek Roman