From bd26f09f55c8a7dd0dce627dcd6a3fa90da66c18 Mon Sep 17 00:00:00 2001 From: Zyy955 <1072411694@qq.com> Date: Thu, 2 Nov 2023 23:30:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0`=E8=B7=B3=E8=BF=87=E7=99=BB?= =?UTF-8?q?=E5=BD=95ICQQ`=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 5 +++++ config/default_config/bot.yaml | 3 +++ lib/bot.js | 15 +++++++++++---- lib/config/qq.js | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 425d2b3..17b0022 100644 --- a/app.js +++ b/app.js @@ -2,3 +2,8 @@ import Yunzai from './lib/bot.js' /** 全局变量 bot */ global.Bot = await Yunzai.run() + +if (Bot.uin == "88888") { + /** 跳过登录后加载插件... */ + await ((await import('./lib/plugins/loader.js')).default).load() +} \ No newline at end of file diff --git a/config/default_config/bot.yaml b/config/default_config/bot.yaml index 6348f11..afb9399 100644 --- a/config/default_config/bot.yaml +++ b/config/default_config/bot.yaml @@ -24,6 +24,9 @@ online_msg: true # 上线推送通知的冷却时间 online_msg_exp: 86400 +# 是否跳过登录ICQQ +skip_login: false + # 签名API地址(如:http://127.0.0.1:8080/sign?key=114514) sign_api_addr: # 传入的QQ版本(如:8.9.63、8.9.68) diff --git a/lib/bot.js b/lib/bot.js index 4dbb3f6..2f9063c 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -14,8 +14,15 @@ export default class Yunzai extends Client { const bot = new Yunzai(cfg.bot) /** 加载icqq事件监听 */ await ListenerLoader.load(bot) - await bot.login(cfg.qq, cfg.pwd) - bot[bot.uin] = bot - return bot + + if (cfg.bot.skip_login) { + /** 造个假~! */ + bot.uin = "88888" + return bot + } else { + await bot.login(cfg.qq, cfg.pwd) + bot[bot.uin] = bot + return bot + } } -} +} \ No newline at end of file diff --git a/lib/config/qq.js b/lib/config/qq.js index 34136f9..2e5621f 100644 --- a/lib/config/qq.js +++ b/lib/config/qq.js @@ -9,6 +9,8 @@ import chalk from 'chalk' * Git Bash 运行npm命令会无法选择列表 */ export default async function createQQ () { + /** 跳过登录ICQQ */ + if(cfg.bot.skip_login) return if (cfg.qq && !process.argv.includes('login')) { return }