Miao-Yunzai/lib/bot.js

29 lines
665 B
JavaScript
Raw Normal View History

2023-03-04 14:30:13 +08:00
import './config/init.js'
import ListenerLoader from './listener/loader.js'
import { Client } from 'icqq'
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 () {
const bot = new Yunzai(cfg.bot)
2023-03-04 14:30:13 +08:00
/** 加载icqq事件监听 */
await ListenerLoader.load(bot)
2023-11-02 23:30:52 +08:00
if (cfg.bot.skip_login) {
/** 造个假~! */
2023-11-03 16:35:08 +08:00
bot.uin = 88888
bot[bot.uin] = bot
2023-11-02 23:30:52 +08:00
return bot
} else {
await bot.login(cfg.qq, cfg.pwd)
bot[bot.uin] = bot
return bot
}
2023-03-04 14:30:13 +08:00
}
2023-11-02 23:30:52 +08:00
}