diff options
author | Kyomotoi <[email protected]> | 2021-03-07 15:24:17 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-03-07 15:24:17 +0800 |
commit | da888ff020805a38a17e5f83705aeb42ffa992ba (patch) | |
tree | 28fa5cc06c3b77970ced9136f12ed2bd94436926 /main.py | |
parent | 51624483cb23e8922cbdf5f529e1dcb2342333a7 (diff) | |
download | ATRI-da888ff020805a38a17e5f83705aeb42ffa992ba.tar.gz ATRI-da888ff020805a38a17e5f83705aeb42ffa992ba.tar.bz2 ATRI-da888ff020805a38a17e5f83705aeb42ffa992ba.zip |
♻️⚡️ 重构 Service,优化部分代码
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 55 |
1 files changed, 17 insertions, 38 deletions
@@ -1,44 +1,23 @@ #!/usr/bin/env python3 -# -*- encoding: utf-8 -*- - +# -*- coding:utf-8 -*- ''' -@File : main.py -@Time : 2021/02/02 15:51:44 -@Author : Kyomotoi -@Contact : [email protected] -@Github : https://github.com/Kyomotoi -@License : Copyright © 2018-2021 Kyomotoi, All Rights Reserved. +File: main.py +Created Date: 2021-02-02 15:51:30 +Author: Kyomotoi +Email: [email protected] +License: GPLv3 +Project: https://github.com/Kyomotoi/ATRI +-------- +Last Modified: Sunday, 7th March 2021 12:25:07 pm +Modified By: Kyomotoi ([email protected]) +-------- +Copyright (c) 2021 Kyomotoi ''' -__author__ = 'kyomotoi' - -from time import sleep -from os import get_terminal_size - -import nonebot -from nonebot.adapters.cqhttp import Bot as CQHTTPBot - -from ATRI.log import logger -from ATRI.config import RUNTIME_CONFIG, COPYRIGHT, VERSION - - -try: - width, height = get_terminal_size() -except OSError: - width, height = 0, 0 -nonebot.init(**RUNTIME_CONFIG) -app = nonebot.get_asgi() -driver = nonebot.get_driver() -driver.register_adapter("cqhttp", CQHTTPBot) -nonebot.load_plugins('ATRI/plugins') +import ATRI +ATRI.init() +app = ATRI.asgi() -if __name__ == "__main__": - logger.warning( - '\n'.join( - i.center(width) for i in COPYRIGHT.splitlines() - ) - ) - logger.info(f"Now running: {VERSION}") - sleep(3) - nonebot.run(app='main:app') +if __name__ == '__main__': + ATRI.run('main:app') |