Replies: 2 comments 10 replies
-
tokens = [
first_token,
second_token,
third_token,
]
bot_tasks = []
for token in tokens:
bot = Bot(token)
dp = Dispatcher(bot)
bot_task = asyncio.create_task(dp.start_polling())
bot_tasks.append(bot_task)
await asyncio.gather(*bot_tasks) |
Beta Was this translation helpful? Give feedback.
10 replies
-
I know its quite late but i fixed it like this: import asyncio
async def start_raid_bot():
dp_bot1 = Dispatcher()
dp_bot1.include_router(raid_router)
await dp_bot1.start_polling(bot1)
async def start_trend_bot():
dp_bot2 = Dispatcher()
dp_bot2.include_router(router_trend_bot)
await dp_bot2.start_polling(bot2)
async def main():
asyncio.create_task(confirm_payment_and_inform_user())
task_bot1 = asyncio.create_task(start_raid_bot())
task_bot2 = asyncio.create_task(start_trend_bot())
await task_bot1
await task_bot2
if __name__ == "__main__":
asyncio.run(main())
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If it is possible, can provide an example
Beta Was this translation helpful? Give feedback.
All reactions