添加`跳过登录ICQQ`开关

This commit is contained in:
Zyy955 2023-11-02 23:30:52 +08:00 committed by Kokomi
parent 4f3a92cb59
commit bd26f09f55
4 changed files with 21 additions and 4 deletions

5
app.js
View File

@ -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()
}

View File

@ -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)

View File

@ -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
}
}
}
}

View File

@ -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
}