From d6811ab9b37e1175b6bf54a24d56af8cd6453fbc Mon Sep 17 00:00:00 2001 From: snowy Date: Tue, 18 Jun 2024 23:57:15 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/test/action_test.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 liteyuki/test/action_test.py diff --git a/liteyuki/test/action_test.py b/liteyuki/test/action_test.py new file mode 100644 index 00000000..1bb92d6c --- /dev/null +++ b/liteyuki/test/action_test.py @@ -0,0 +1,29 @@ +import nonebot +from liteyuki.utils import adapter_manager, driver_manager, init +from liteyuki.utils.base.config import load_from_yaml +from liteyuki.utils.base.data_manager import StoredConfig, common_db +from liteyuki.utils.base.ly_api import liteyuki_api + +if __name__ == "__mp_main__": + # Start as multiprocessing + init() + store_config: dict = common_db.where_one(StoredConfig(), default=StoredConfig()).config + static_config = load_from_yaml("config.yml") + store_config.update(static_config) + driver_manager.init(config=store_config) + adapter_manager.init(store_config) + nonebot.init(**store_config) + adapter_manager.register() + try: + nonebot.load_plugin("liteyuki.liteyuki_main") + nonebot.load_from_toml("pyproject.toml") + except BaseException as e: + 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__())) + +if __name__ == "__main__": + # Start as __main__ + from liteyuki.utils.base.reloader import Reloader + + nonebot.run()