diff --git a/matrix_pygmalion_bot/core.py b/matrix_pygmalion_bot/core.py index fa0252f..436d533 100644 --- a/matrix_pygmalion_bot/core.py +++ b/matrix_pygmalion_bot/core.py @@ -362,9 +362,16 @@ async def main() -> None: bots.append(bot) await bot.login() print("gather") - async with asyncio.TaskGroup() as tg: + if sys.version_info[0] == 3 and sys.version_info[1] < 11: + tasks = [] for bot in bots: - task = tg.create_task(bot.client.sync_forever(timeout=30000, full_state=True)) + task = asyncio.create_task(bot.client.sync_forever(timeout=30000, full_state=True)) + tasks.append(task) + await asyncio.gather(*tasks) + else: + async with asyncio.TaskGroup() as tg: + for bot in bots: + task = tg.create_task(bot.client.sync_forever(timeout=30000, full_state=True)) if __name__ == "__main__": asyncio.get_event_loop().run_until_complete(main())