安卓Termux机器人系列第三期~
感兴趣可以翻阅前两期:
这次咱们搭建一个云崽原神bot
不装了我就是OP
准备工作:
- 一个安卓手机(废话),无需root
- 魔法上网工具(提升下载速度,你也可以自行换国内源)
- 下载安装 Termux
Now here we go
你可以参考云崽的官方文档搭建原版云崽bot:
https://docs.yunzai.org/deploy/android/你也可以参考本教程搭建喵版云崽bot,二者的区别可以自行搜索
安装 Alpine Linux
pkg install proot-distro
proot-distro install alpine
等待安装完成后启动 Alpine Linux :
proot-distro login alpine
安装依赖
添加软件源:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories
apk update && apk upgrade
安装依赖:
apk add nodejs npm redis git chromium wqy-zenhei
安装喵崽
喵仔项目仓库:
https://gitee.com/yoimiya-kokomi/Miao-Yunzai
克隆项目并安装miao-plugin:
# 使用 Github git clone --depth=1 https://github.com/yoimiya-kokomi/Miao-Yunzai.git cd Miao-Yunzai git clone --depth=1 https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ # 使用Gitee git clone --depth=1 https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git cd Miao-Yunzai git clone --depth=1 https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/
国内建议用 Gitee 速度快些
安装pnpm ,已安装的可以跳过
# 使用npmjs.org安装 npm install pnpm -g # 或者指定国内源npmmirror.com安装 npm --registry=https://registry.npmmirror.com install pnpm -g
安装依赖
# 直接安装 pnpm install -P # 如依赖安装缓慢或失败,可尝试更换国内npm源后再执行install命令 pnpm config set registry https://registry.npmmirror.com pnpm install -P
运行(首次运行按提示输入登录)
node app
你可以自由安装插件,Yunzai-Bot 相关内容索引:
https://gitee.com/yhArcadia/Yunzai-Bot-plugins-index
常见问题
我自己遇到的问题:
puppeteer Chromium 启动失败
使用 `npm install puppeteer@13.7.0` 命令将puppeteer降级为13.7.0版本即可启动Chrome;报错信息:
[MiaoYz][12:40:37.571][MARK] puppeteer Chromium 启动中... 获取Mac地址失败 TypeError: Cannot read properties of undefined (reading 'filter')
Puppeteer old Headless deprecation warning:
In the near featureheadless: true
will default to the new Headless mode
for Chrome instead of the old Headless implementation. For more
information, please see https://developer.chrome.com/articles/new-headless/.
Consider opting in early by passingheadless: "new"
topuppeteer.launch()
If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.
[MiaoYz][12:40:37.620][ERRO] {}
Error: Failed to launch the browser process! spawn /root/.cache/puppeteer/chrome/linux-113.0.5672.63/chrome-linux64/chrome ENOENTTROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (file:///root/Miao-Yunzai/node_modules/.pnpm/@puppeteer+browsers@1.3.0/node_modules/@puppeteer/browsers/lib/esm/launch.js:253:24) at ChildProcess.emit (node:events:513:28) at ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) undefined
[MiaoYz][12:40:37.627][ERRO] puppeteer Chromium 启动失败
但是程序可以正常启动使用了,无视即可。你也可以自行搜索其他方案此时仍有报错提示:
[MiaoYz][14:28:55.613][MARK] puppeteer Chromium 启动中... 获取Mac地址失败 TypeError: Cannot read properties of undefined (reading 'filter') chromium ws://127.0.0.1:37579/devtools/browser/1bcd7f4a-1228-4492-b020-4d1c0045ebde [MiaoYz][14:28:58.162][MARK] puppeteer Chromium 启动成功
仓库文档常见问题:
https://gitee.com/yoimiya-kokomi/Miao-Yunzai#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98Salipet云崽问题合集:
https://www.wolai.com/oA43vuW71aBnv7UsEysn4T
后知后觉:云崽需要NodeJS版本大于18.0,我前两期bot教程里的环境无法满足,所以只好用 proot-distro 安装新的 linux环境,如果你熟悉linux,你也可以将其它bot统一部署到同一个Linux环境中