2023-03-04 14:30:13 +08:00
|
|
|
import './config/init.js'
|
|
|
|
import ListenerLoader from './listener/loader.js'
|
2024-03-27 01:53:39 +08:00
|
|
|
import { Client } from 'icqq'
|
2023-03-04 14:30:13 +08:00
|
|
|
import cfg from './config/config.js'
|
|
|
|
|
|
|
|
export default class Yunzai extends Client {
|
|
|
|
// eslint-disable-next-line no-useless-constructor
|
2023-03-11 09:35:53 +08:00
|
|
|
constructor (conf) {
|
|
|
|
super(conf)
|
2023-03-04 14:30:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 登录机器人 */
|
|
|
|
static async run () {
|
2023-03-04 15:24:28 +08:00
|
|
|
const bot = new Yunzai(cfg.bot)
|
2024-01-10 14:54:20 +08:00
|
|
|
/** 加载监听事件 */
|
2023-03-04 14:30:13 +08:00
|
|
|
await ListenerLoader.load(bot)
|
2023-11-02 23:30:52 +08:00
|
|
|
|
2024-01-10 14:54:20 +08:00
|
|
|
/** 跳过登录 */
|
|
|
|
if (cfg.bot.skip_login) return await this.skip_login(bot)
|
|
|
|
|
|
|
|
/** 正常的登录 */
|
|
|
|
await bot.login(cfg.qq, cfg.pwd)
|
|
|
|
bot[bot.uin] = bot
|
|
|
|
|
|
|
|
/** 全局变量 bot */
|
|
|
|
global.Bot = bot
|
|
|
|
return bot
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 跳过登录ICQQ */
|
|
|
|
static async skip_login (bot) {
|
|
|
|
bot.uin = 88888
|
|
|
|
bot[bot.uin] = bot
|
|
|
|
/** 全局变量 bot */
|
|
|
|
global.Bot = bot
|
|
|
|
/** 加载插件 */
|
|
|
|
return await ((await import('../lib/plugins/loader.js')).default).load()
|
2023-03-04 14:30:13 +08:00
|
|
|
}
|
2024-01-10 14:54:20 +08:00
|
|
|
}
|