79522753

Date: 2025-03-20 11:22:04
Score: 1
Natty:
Report link

https://docs.aiogram.dev/en/dev-3.x/migration_2_to_3.html#filtering-events

Migration FAQ (2.x -> 3.0)

This works in 2025 aiogram with filtres. Thanks to the author for the explanation

from aiogram import Bot, Dispatcher
from aiogram.types import Message
from aiogram import F

import asyncio
from secret import TOKEN

dp = Dispatcher()
bot = Bot(token=TOKEN)

@dp.message(F.voice)
async def voice_message_handler(message: Message):
    path = "/home/user/"

    await bot.download(
        message.voice,
        destination=path + "%s.ogg" % message.voice.file_id
    )

asyncio.run(dp.start_polling(bot))
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Wera