nonebot2/tests/bot.py

30 lines
560 B
Python
Raw Normal View History

2020-06-30 10:13:58 +08:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
2020-07-04 22:51:10 +08:00
sys.path.insert(0, os.path.abspath(".."))
2020-06-30 10:13:58 +08:00
import nonebot
from nonebot.log import logger, default_format
# test custom log
logger.add("error.log",
rotation="00:00",
diagnose=False,
level="ERROR",
format=default_format)
2020-06-30 10:13:58 +08:00
2020-07-04 22:51:10 +08:00
nonebot.init()
app = nonebot.get_asgi()
# load builtin plugin
nonebot.load_plugin("nonebot.plugins.base")
# load local plugins
2020-07-04 22:51:10 +08:00
nonebot.load_plugins("test_plugins")
2020-06-30 10:13:58 +08:00
if __name__ == "__main__":
2020-07-04 22:51:10 +08:00
nonebot.run(app="bot:app")