2024-03-18 18:21:56 +08:00
|
|
|
import nonebot
|
2024-06-26 13:52:04 +08:00
|
|
|
from src.utils import adapter_manager, driver_manager, init
|
|
|
|
from src.utils.base.config import load_from_yaml
|
|
|
|
from src.utils.base.data_manager import StoredConfig, common_db
|
|
|
|
from src.utils.base.ly_api import liteyuki_api
|
2024-03-23 19:55:12 +08:00
|
|
|
|
2024-05-09 00:09:18 +08:00
|
|
|
if __name__ == "__mp_main__":
|
2024-05-26 16:38:38 +08:00
|
|
|
# Start as multiprocessing
|
2024-05-10 00:12:48 +08:00
|
|
|
init()
|
2024-05-12 00:18:53 +08:00
|
|
|
store_config: dict = common_db.where_one(StoredConfig(), default=StoredConfig()).config
|
2024-05-10 00:12:48 +08:00
|
|
|
static_config = load_from_yaml("config.yml")
|
|
|
|
store_config.update(static_config)
|
2024-05-17 16:26:30 +08:00
|
|
|
driver_manager.init(config=store_config)
|
2024-05-17 17:51:42 +08:00
|
|
|
adapter_manager.init(store_config)
|
2024-05-10 00:12:48 +08:00
|
|
|
nonebot.init(**store_config)
|
2024-05-17 17:51:42 +08:00
|
|
|
adapter_manager.register()
|
2024-03-25 12:55:16 +08:00
|
|
|
try:
|
2024-06-26 13:52:04 +08:00
|
|
|
nonebot.load_plugin("src.liteyuki_main")
|
2024-05-08 23:40:16 +08:00
|
|
|
nonebot.load_from_toml("pyproject.toml")
|
2024-03-25 12:55:16 +08:00
|
|
|
except BaseException as e:
|
2024-03-27 08:03:19 +08:00
|
|
|
if not isinstance(e, KeyboardInterrupt):
|
|
|
|
nonebot.logger.error(f"An error occurred: {e}, Bug will be reported automatically.")
|
|
|
|
liteyuki_api.bug_report(str(e.__repr__()))
|
2024-05-09 00:09:18 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-05-26 16:38:38 +08:00
|
|
|
# Start as __main__
|
2024-06-26 13:52:04 +08:00
|
|
|
from src.utils.base.reloader import Reloader
|
2024-06-09 22:36:58 +08:00
|
|
|
nonebot.run()
|