summaryrefslogtreecommitdiff
path: root/main.py
blob: 648e571fe1f0a3db40d1359af95b2ef3e7a2be76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-

'''
@File    :   main.py
@Time    :   2021/01/23 12:49:54
@Author  :   Kyomotoi
@Contact :   [email protected]
@Github  :   https://github.com/Kyomotoi
@License :   Copyright © 2018-2020 Kyomotoi, All Rights Reserved.
'''
__author__ = 'kyomotoi'

from time import sleep
from os import get_terminal_size

import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot

from nonebot.log import logger
from ATRI.config import COPYRIGHT, RUNTIME_CONFIG, 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')

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')