From da888ff020805a38a17e5f83705aeb42ffa992ba Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Sun, 7 Mar 2021 15:24:17 +0800 Subject: =?UTF-8?q?=E2=99=BB=EF=B8=8F=E2=9A=A1=EF=B8=8F=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=20Service=EF=BC=8C=E4=BC=98=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 55 +++++++++++++++++-------------------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 1d3afbe..d80d30c 100644 --- a/main.py +++ b/main.py @@ -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 : kyomotoiowo@gmail.com -@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: Kyomotoiowo@gmail.com +License: GPLv3 +Project: https://github.com/Kyomotoi/ATRI +-------- +Last Modified: Sunday, 7th March 2021 12:25:07 pm +Modified By: Kyomotoi (kyomotoiowo@gmail.com) +-------- +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') -- cgit v1.2.3