代码拉取完成,页面将自动刷新
同步操作将从 Kokomi/Yunzai-Bot 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import { check } from './lib/check.js'
import { init } from './lib/init.js'
import { createClient } from 'oicq'
import solve from './lib/dealMsg.js'
process.title = 'Yunzai-Bot'
// 检查配置文件
await check()
// 创建oicq
const Bot = createClient(BotConfig.account.qq, {
log_level: BotConfig.account.log_level,
platform: BotConfig.account.platform,
resend: false,
data_dir: process.cwd() + '/data'
})
global.Bot = Bot
// 扫码登录 or 密码登录
Bot.on('system.login.qrcode', function (e) {
this.logger.mark('扫码后按Enter回车完成登录')
process.stdin.once('data', () => {
this.login()
})
}).login(BotConfig.account.pwd)
// 提交滑动验证码
Bot.on('system.login.slider', function (e) {
this.logger.mark('请输入获取的ticket,按回车完成【滑动验证】')
process.stdin.once('data', (input) => {
this.submitSlider(input)
})
})
// 设备锁
Bot.on('system.login.device', function (e) {
process.stdin.once('data', () => {
this.login()
})
})
// 登录错误
Bot.on('system.login.error', function (e) {
if (e.code == 1) this.logger.error('请打开config.js,修改输入正确的密码')
process.exit()
})
// 监听上线事件
Bot.on('system.online', async () => {
await init()
})
// 监听群聊消息事件
Bot.on('message.group', (event) => {
event.isGroup = true
solve.dealMsg(event).catch((error) => {
Bot.logger.error(error)
})
})
// 监听私聊消息事件
Bot.on('message.private', (event) => {
event.isPrivate = true
solve.dealMsg(event).catch((error) => {
Bot.logger.error(error)
})
})
// 监听好友事件
Bot.on('request.friend', (event) => {
solve.dealFriend(event)
})
// 监听群通知
Bot.on('notice.group', (event) => {
event.isGroup = true
solve.dealGroupNotice(event).catch((error) => {
Bot.logger.error(error)
})
})
// 监听群事件
Bot.on('request.group', (event) => {
solve.dealGroupRequest(event)
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。