Browse Source

python 3.9 compatibility

master
Hendrik Langer 2 years ago
parent
commit
f5265f5c87
  1. 11
      matrix_pygmalion_bot/core.py

11
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())

Loading…
Cancel
Save