Awesome
YZ-NEXT-PE
Yunzai-Bot Next PE 是 Next 库的纯净版
安装
必备条件Chrome
、Node.js@18
、Git
、Redis-6.2
git clone --depth=1 https://github.com/yunzai-org/yunzai-bot.git
cd yunzai-bot
# 国内镜像,已安装可忽视
npm config set registry https://registry.npmmirror.com
# yarn 不能使用2.x版本,它无法使用link
npm install yarn@1.19.1 -g
yarn --ignore-engines
# 运行
yarn app
自建
自建版本无v3环境
npm init
输入版本时,需要标记4.1.0,其他随意
- 依赖
npm install yarn@1.19.1 -g
yarn add yunzai react-puppeteer react puppeteer yz-system -W
- src/main.js
import { createLogin, Client, Processor, Loader } from 'yunzai'
const initialize = () => {
Processor.install()
Loader.load()
}
const start = async () => {
await createLogin()
const T = await Client.run()
if (T) {
Bot.on('system.online', initialize)
} else {
initialize()
}
}
setTimeout(start, 0)
- yunzai.config.js
import { defineConfig } from 'yunzai'
export default defineConfig({
applications: ['yz-system']
})
- .puppeteerrc.cjs
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = require('react-puppeteer/.puppeteerrc')
- 运行
node src/main.js
node src/main.js --relogin
- 后台运行
yarn add pm2 -W
- pm2.config.cjs
/**
* @type {{ apps: import("pm2").StartOptions[] }}
*/
module.exports = require('yunzai/pm2')
npx pm2 startOrRestart pm2.config.cjs