From c2a7f3cd6bc9f119c2dba253dc76c3e0c172b85f Mon Sep 17 00:00:00 2001 From: ningmengchongshui <916415899@qq.com> Date: Mon, 17 Jun 2024 17:00:01 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=85=BC=E5=AE=B9=E5=B0=B1=E6=80=A7?= =?UTF-8?q?=E4=BF=9D=E7=95=99Runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- src/config/index.ts | 3 ++- src/{qq.ts => config/login.ts} | 12 ++++++++---- src/core/index.ts | 2 ++ src/main.ts | 9 +++++++-- 5 files changed, 20 insertions(+), 8 deletions(-) rename src/{qq.ts => config/login.ts} (94%) diff --git a/.gitignore b/.gitignore index df7d291..72727b9 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,4 @@ docs/ public/ html/ -plugins \ No newline at end of file +plugins/ \ No newline at end of file diff --git a/src/config/index.ts b/src/config/index.ts index 3a79adb..bd69bd5 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,3 +1,4 @@ export * from './system.js' import ConfigController from './config.js' -export { ConfigController } \ No newline at end of file +export { ConfigController } +export { createLogin } from './login.js' \ No newline at end of file diff --git a/src/qq.ts b/src/config/login.ts similarity index 94% rename from src/qq.ts rename to src/config/login.ts index 6a1af88..14b2ed2 100644 --- a/src/qq.ts +++ b/src/config/login.ts @@ -5,16 +5,20 @@ import { BOT_NAME, CONFIG_DEFAULT_PATH, CONFIG_INIT_PATH, - ConfigController as cfg -} from 'yunzai/config' -import { sleep } from 'yunzai/utils' +} from './system.js' +import cfg from './config.js' + +function sleep(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)) +} + /** * 创建qq配置文件 `config/bot/qq.yaml` * Git Bash 运行npm命令会无法选择列表 * @returns */ -export async function createQQ() { +export async function createLogin() { /** 跳过登录ICQQ */ if (cfg.bot.skip_login) return /** diff --git a/src/core/index.ts b/src/core/index.ts index db5de50..6a8a150 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -4,3 +4,5 @@ export * from './plugins/types.js' export * from './plugins/common.js' export * from './icqq.js' export * from './bot.js' +import Runtime from './plugins/runtime.js' +export { Runtime } diff --git a/src/main.ts b/src/main.ts index fb519ff..a00459b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,12 +1,17 @@ import 'yunzai/init' import { Client } from 'yunzai/core' -import { createQQ } from './qq.js' +import { createLogin } from 'yunzai/config' /** + * ********************* * 确保所有微任务做好准备后 * 再进行宏任务 + * **************** */ setTimeout(async () => { - await createQQ() + /** + * login + */ + await createLogin() /** * run */