Exemplo n.º 1
0
    def create_bot_stuff(self):
        d = self.deps

        d.bot = Bot(token=d.cfg.telegram.bot.token, parse_mode=ParseMode.HTML)
        d.dp = Dispatcher(d.bot, loop=d.loop)
        d.loc_man = LocalizationManager()
        d.broadcaster = Broadcaster(d)

        init_dialogs(d)
Exemplo n.º 2
0
 def telegram_chats_from_config(self, loc_man: LocalizationManager):
     channels = self.cfg.telegram.channels
     return {
         chan['name']: loc_man.get_from_lang(chan['lang'])
         for chan in channels if chan['type'] == 'telegram'
     }
from services.lib.config import Config
from services.lib.db import DB
from services.lib.depcont import DepContainer


async def q_points(d: DepContainer):
    image = await queue_graph(d, d.loc_man.get_from_lang('rus'))
    p = os.path.expanduser('~/sns_test.png')
    with open(p, 'wb') as f:
        f.write(image.getvalue())
        os.system(f'open "{p}"')


async def stake_graph():
    ...


async def test_plots(d):
    # await q_points(d)
    await stake_graph()


if __name__ == '__main__':
    d = DepContainer()
    d.loc_man = LocalizationManager()
    d.loop = asyncio.get_event_loop()
    d.cfg = Config()
    d.db = DB(d.loop)

    d.loop.run_until_complete(test_plots(d))