示例#1
0
def setup(runner: Executor):
    runner.on_startup(on_startup)
    runner.on_shutdown(on_shutdown)
示例#2
0
文件: runbot.py 项目: LVNIT/Karaka
from tortoise import Tortoise

from alarmbot.loghandlers import ColorizedStderrHandler
from alarmbot.models import init_db
from alarmbot.receptionist import dp

# Configure logging
logger = Logger(__name__)
logger.handlers.append(ColorizedStderrHandler())


async def init_orm(dispatcher):
    await init_db()


async def close_orm(dispatcher):
    await Tortoise.close_connections()


if __name__ == '__main__':
    logger.level = logbook.DEBUG
    logging.basicConfig(level=logging.INFO)
    loop = asyncio.get_event_loop()
    executor = Executor(dp, skip_updates=True, loop=loop)
    logger.info('{}', executor)
    executor.on_startup(init_orm, polling=True)
    executor.on_shutdown(close_orm, polling=True)
    # executor.set_webhook(web_app=app)
    # executor.run_app(port=8000)
    executor.start_polling()
示例#3
0
def vk_broadcaster_setup(runner: Executor):
    runner.on_startup(on_startup)
    runner.on_shutdown(on_shutdown)
def setup(executor: Executor):
    executor.on_startup(on_startup)
    executor.on_shutdown(on_shutdown)
示例#5
0
def scheduler_setup(executor: Executor):
    executor.on_startup(on_startup)
    executor.on_shutdown(on_shutdown)
示例#6
0
def setup(executor: Executor, db_config: DBConfig):
    executor.on_startup(partial(on_startup, db_config=db_config))
    executor.on_shutdown(on_shutdown)