import asyncio from matrix import MatrixLoop from abstract_source_platform.telegram import Telegram from config_dataclass import Config CONFIG_FILE_NAME = "config.yaml" def main(): config = Config.from_yaml_config(CONFIG_FILE_NAME) asyncio.run(Application(config).run()) class Application: def __init__(self, config): self.config = config self.matrix_loop = MatrixLoop(self) self.telegram = Telegram(self) async def run(self): try: await self.matrix_loop.prepare() await asyncio.gather( self.matrix_loop.run(), self.telegram.run(), ) finally: if self.matrix_loop: await self.matrix_loop.finish() if __name__ == "__main__": main()