An alternative for dispatcher loop in Aiogram 3

Question:

I have a telegram bot running on Aiogram 2.x. Now I am rewriting it for Aiogram 3.x. I have successfully been able to implement all functions except the one that should occur in an infinite loop. In Aiogram 2.x, I used this feature:

dp.loop.create_task(loop_fn())

But in Aiogram 3.x, this function does not work. I need an alternative to this feature in Aiogram 3.x. I tried searching the Aiogram documentation, but I didn’t find it.

Try to use the asyncio library, like, instead of using the dispatcher’s loop, use asyncio.create_task

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.