patch 2dc409973eb2934cb273a0707b662b85959cf03d
Author: E. Bosch <presidev@AT@gmail.com>
Date: Thu Jan 28 00:13:48 CET 2021
* telegram: Replace telegram_client.start() with telegram_client.connect()
This will allow to set the verification code (if necessary) from IRC
hunk ./irgramd 5
-
-import tornado.ioloop
+import asyncio
+
hunk ./irgramd 34
- def run(self):
+ async def run(self):
hunk ./irgramd 42
- self.tg_handler.initialize_telegram()
-
- tornado.ioloop.IOLoop.current().start()
+ await self.tg_handler.initialize_telegram()
hunk ./irgramd 55
- irc_server.run()
+ asyncio.get_event_loop().run_until_complete(irc_server.run())
+ asyncio.get_event_loop().run_forever()
hunk ./telegram.py 26
-
- def initialize_telegram(self):
+ self.authorized = False
+
+ async def initialize_telegram(self):
hunk ./telegram.py 57
- self.telegram_client.start()
+ await self.telegram_client.connect()
+
+ if await self.telegram_client.is_user_authorized():
+ self.authorized = True
+ await self.init_mapping()
+
+ async def init_mapping(self):
hunk ./telegram.py 65
- for dialog in self.telegram_client.iter_dialogs():
+ async for dialog in self.telegram_client.iter_dialogs():