S
S
sadacolifr2021-12-04 23:48:46
Python
sadacolifr, 2021-12-04 23:48:46

How to combine the work of aiogram and telethon?

I have in the code like Telethon's handlers:

@client.on(events.NewMessage(forwards=False))
async def normal_handler1(event):

So is aiogram:
@dp.message_handler(content_types=['text'])
async def main(message: types.Message):

But when the code is run, only one module is launched, whose command will work first:
executor.start_polling(dp)
asyncio.create_task(client.run_until_disconnected())

So, how to make these two commands run successfully? Since they don't seem to run one by one...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question