Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

请问如何保持Bot始终处于运行状态 #645

Closed
Immortal68 opened this issue Feb 9, 2022 · 13 comments
Closed

请问如何保持Bot始终处于运行状态 #645

Immortal68 opened this issue Feb 9, 2022 · 13 comments
Assignees
Labels
question Further information is requested

Comments

@Immortal68
Copy link

问题描述

SSH对话关闭后bot自动下线了,必须重新使用npm run init使bot上线。
如果使用Supervisor管理器会因为Chrome导致绘图失败,报错:genshin-gacha 功能绘图失败,因为“Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (950341).”
请问应该如何解决,实现bot持续运行?感谢!

复现流程

genshin-gacha 功能绘图失败,因为“Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (950341).”

后台日志

No response

代码状态:当前提交

2119862 Merge branch 'dev' of https://github.com/Arondight/Adachi-B (END)

代码状态:是否修改

No response

运行环境: Node.js 版本

No response

运行环境: npm 版本

No response

运行环境:操作系统

Linux

@Immortal68 Immortal68 added bug Something isn't working question Further information is requested labels Feb 9, 2022
@mark9804
Copy link
Collaborator

mark9804 commented Feb 9, 2022

尝试过 npm run start 吗,npm run init 只是第一次初始化 bot 需要 QQ 登陆才使用的,后续可以使用 npm run start 运行 bot , npm run stop 停止 bot 运行

@mark9804 mark9804 removed the bug Something isn't working label Feb 9, 2022
@Immortal68
Copy link
Author

Immortal68 commented Feb 9, 2022

尝试过 npm run start 吗,npm run init 只是第一次初始化 bot 需要 QQ 登陆才使用的,后续可以使用 npm run start 运行 bot , npm run stop 停止 bot 运行

不行,npm run start虽然可以运行但是无法启动bot,每次启动必须要用npm run init QQ才能上线

@mark9804
Copy link
Collaborator

mark9804 commented Feb 9, 2022

npm run start 虽然可以运行但是无法启动 bot

这种情况理论上是不应该发生的,麻烦使用 npm run start 之后,运行一下 npm run log ,然后把 bot 的日志信息贴出来给我们看看。没有日志我们不太清楚发生了什么,虽然我有一个猜想,但是需要日志信息验证

@Immortal68
Copy link
Author

Immortal68 commented Feb 9, 2022

> [email protected] log
> cross-env-shell PM2_HOME=$INIT_CWD/bot.pm2/ npx pm2 log --lines 100 bot

[TAILING] Tailing last 100 lines for [bot] process (change the value with --lines option)
/root/Adachi-BOT/bot.pm2/logs/bot-error.log last 100 lines:
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }
0|bot      | Error: listen EADDRINUSE: address already in use 127.0.0.1:9934
0|bot      |     at Server.setupListenHandle [as _listen2] (node:net:1330:16)
0|bot      |     at listenInCluster (node:net:1378:12)
0|bot      |     at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
0|bot      |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
0|bot      |   code: 'EADDRINUSE',
0|bot      |   errno: -98,
0|bot      |   syscall: 'listen',
0|bot      |   address: '127.0.0.1',
0|bot      |   port: 9934
0|bot      | }

/root/Adachi-BOT/bot.pm2/logs/bot-out.log last 100 lines:
0|bot      |                                        
0|bot      |                                                                                                               
0|bot      |                                                                                                               
0|bot      |                    项目主页:https://github.com/Arondight/Adachi-BOT
0|bot      | [2022-02-09T21:27:49.730] [DEBUG] [Watch:3256501062] - 配置:加载了 1 条 Cookie 。
0|bot      | [2022-02-09T21:27:49.730] [DEBUG] [Watch:3256501062] - 配置:登录账号 3256501062 。
0|bot      | [2022-02-09T21:27:49.731] [DEBUG] [Watch:3256501062] - 配置:管理者已设置为 726895453 。
0|bot      | [2022-02-09T21:27:49.731] [DEBUG] [Watch:3256501062] - 配置:所有的消息都将被视为命令。
0|bot      | [2022-02-09T21:27:49.732] [DEBUG] [Watch:3256501062] - 配置:允许用户 @ 机器人。
0|bot      | [2022-02-09T21:27:49.732] [DEBUG] [Watch:3256501062] - 配置:群回复将会 @ 用户。
0|bot      | [2022-02-09T21:27:49.732] [DEBUG] [Watch:3256501062] - 配置:群消息复读的概率为 0.25% 。
0|bot      | [2022-02-09T21:27:49.732] [DEBUG] [Watch:3256501062] - 配置:上线发送群通知。
0|bot      | [2022-02-09T21:27:49.732] [DEBUG] [Watch:3256501062] - 配置:向新群友问好。
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:向新好友问好。
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:推送米游社新闻。
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:角色查询尝试更新玩家信息。
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:耗时操作前不发送提示。
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:用户每隔 0 秒可以使用一次机器人。
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:115 秒后尝试撤回机器人发送的群消息
0|bot      | [2022-02-09T21:27:49.733] [DEBUG] [Watch:3256501062] - 配置:广播中消息间时延 0.20 秒。
0|bot      | [2022-02-09T21:27:49.734] [DEBUG] [Watch:3256501062] - 配置:深渊记录将缓存 1 小时。
0|bot      | [2022-02-09T21:27:49.734] [DEBUG] [Watch:3256501062] - 配置:玩家信息将缓存 1 小时。
0|bot      | [2022-02-09T21:27:49.734] [DEBUG] [Watch:3256501062] - 配置:清理数据库 aby 中超过 1 小时的记录。
0|bot      | [2022-02-09T21:27:49.734] [DEBUG] [Watch:3256501062] - 配置:清理数据库 info 中超过 168 小时的记录。
0|bot      | [2022-02-09T21:27:49.734] [DEBUG] [Watch:3256501062] - 配置:不使用前端调试模式。
0|bot      | [2022-02-09T21:27:49.734] [DEBUG] [Watch:3256501062] - 配置:不保存图片。
0|bot      | [2022-02-09T21:27:51.809] [DEBUG] [Watch:3256501062] - 卡池:内容已刷新。
0|bot      | [2022-02-09T21:27:51.810] [DEBUG] [Watch:3256501062] - 清理:删除数据库 aby 中 0 条无用记录。
0|bot      | [2022-02-09T21:27:51.838] [DEBUG] [Watch:3256501062] - 清理:删除数据库 cookies 中 0 条无用记录。
0|bot      | [2022-02-09T21:27:51.838] [DEBUG] [Watch:3256501062] - 清理:删除数据库 cookies_invalid 中 0 条无用记录。
0|bot      | [2022-02-09T21:27:51.841] [DEBUG] [Watch:3256501062] - 清理:删除数据库 info 中 0 条无用记录
0|bot      | [2022-02-09T21:27:51.842] [DEBUG] [Watch:3256501062] - 同步:将数据库 aby 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.842] [DEBUG] [Watch:3256501062] - 同步:将数据库 artifact 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.842] [DEBUG] [Watch:3256501062] - 同步:将数据库 authority 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.843] [DEBUG] [Watch:3256501062] - 同步:将数据库 character 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.843] [DEBUG] [Watch:3256501062] - 同步:将数据库 cookies 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.844] [DEBUG] [Watch:3256501062] - 同步:将数据库 cookies_invalid 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.845] [DEBUG] [Watch:3256501062] - 同步:将数据库 gacha 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.845] [DEBUG] [Watch:3256501062] - 同步:将数据库 info 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.846] [DEBUG] [Watch:3256501062] - 同步:将数据库 map 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.846] [DEBUG] [Watch:3256501062] - 同步:将数据库 music 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.852] [DEBUG] [Watch:3256501062] - 同步:将数据库 news 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.853] [DEBUG] [Watch:3256501062] - 同步:将数据库 time 缓存写入到磁盘。
0|bot      | [2022-02-09T21:27:51.928] [DEBUG] [Watch:3256501062] - 插件:加载 aby 成功。
0|bot      | [2022-02-09T21:27:51.940] [DEBUG] [Watch:3256501062] - 插件:加载 artifacts 成功。
0|bot      | [2022-02-09T21:27:51.945] [DEBUG] [Watch:3256501062] - 插件:加载 card 成功。
0|bot      | [2022-02-09T21:27:51.951] [DEBUG] [Watch:3256501062] - 插件:加载 character 成功。
0|bot      | [2022-02-09T21:27:51.972] [DEBUG] [Watch:3256501062] - 插件:加载 gacha 成功。
0|bot      | [2022-02-09T21:27:51.977] [DEBUG] [Watch:3256501062] - 插件:加载 master 成功。
0|bot      | [2022-02-09T21:27:51.983] [DEBUG] [Watch:3256501062] - 插件:加载 material 成功。
0|bot      | [2022-02-09T21:27:51.989] [DEBUG] [Watch:3256501062] - 插件:加载 music 成功。
0|bot      | [2022-02-09T21:27:51.994] [DEBUG] [Watch:3256501062] - 插件:加载 overview 成功。
0|bot      | [2022-02-09T21:27:52.001] [DEBUG] [Watch:3256501062] - 插件:加载 package 成功。
0|bot      | [2022-02-09T21:27:52.010] [DEBUG] [Watch:3256501062] - 插件:加载 rating 成功。
0|bot      | [2022-02-09T21:27:52.015] [DEBUG] [Watch:3256501062] - 插件:加载 save 成功。
0|bot      | [2022-02-09T21:27:52.022] [DEBUG] [Watch:3256501062] - 插件:加载 tools 成功。
0|bot      | [2022-02-09T21:27:52.069] [DEBUG] [Watch:3256501062] - 插件:加载 tools_master 成功。
0|bot      | [2022-02-09T21:27:52.286] [MARK] [Watch:3256501062] - 203.205.255.220:8080 connected
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      |                                                                       
0|bot      | [2022-02-09T21:27:52.648] [MARK] [Watch:3256501062] - 请用手机QQ扫描二维码,若打印出错请打开:/root/Adachi-BOT/node_modules/pm2/lib/data/3256501062/qrcode.png
0|bot      | [2022-02-09T21:27:52.648] [MARK] [Watch:3256501062] - 手机扫码完成后按下回车键继续。

还有就是我觉得端口报错log是我下午当时重复启动留下的

@mark9804
Copy link
Collaborator

mark9804 commented Feb 9, 2022

如果你使用 npm run init 启动的话,也是每次需要扫码才能登陆吗?还是说 npm run init 不需要扫码登陆,但是运行 npm run start 的时候需要扫码登陆?

另外试着切换一下登陆协议(登陆平台),看看在重新 run init 之后能不能正常使用 run start 启动

@Immortal68
Copy link
Author

Immortal68 commented Feb 9, 2022

如果你使用 npm run init 启动的话,也是每次需要扫码才能登陆吗?还是说 npm run init 不需要扫码登陆,但是运行 npm run start 的时候需要扫码登陆?

另外试着切换一下登陆协议(登陆平台),看看在重新 run init 之后能不能正常使用 run start 启动

npm run init扫码登录后Bot直接可以正常运行,后续也可以直接使用npm run init(无需再次扫码和npm run start)正常运行QQ bot,但是如果中止ssh会话 QQbot会说“我下线了”(实际上仍然在线,但功能无法使用)

如果第一次以npm run init扫码登录,后续以npm run start启动都会显示 如图 但是实际上QQ依旧在线但是功能无法使用,bot也不会发“我上线了”的消息

@mark9804
Copy link
Collaborator

mark9804 commented Feb 9, 2022

我叫个老大哥过来看看 @Arondight

@Arondight
Copy link
Owner

npm run restart

npm run log

贴一下输出

@Arondight
Copy link
Owner

额,我刚注意到上面有日志,扫码不行就用密码登陆

@Immortal68
Copy link
Author

额,我刚注意到上面有日志,扫码不行就用密码登陆

密码登录的话会提示找不到 masterQQ号 所在群组,所以不得不扫码

@Arondight
Copy link
Owner

额,我刚注意到上面有日志,扫码不行就用密码登陆

密码登录的话会提示找不到 masterQQ号 所在群组,所以不得不扫码

这个无所谓的,只是你的 bot 没加 master 为好友(或者作为群友),另外扫码和密码都不会改变这个问题

@Arondight Arondight self-assigned this Feb 10, 2022
@Arondight
Copy link
Owner

另外

  1. 我记得手机扫码允许永久登录后第二次好像不用再扫码吧,也可能是我记错了
  2. 密码登录记得设备认证 如何获得滑动验证码 ticket #310

@Immortal68
Copy link
Author

另外

  1. 我记得手机扫码允许永久登录后第二次好像不用再扫码吧,也可能是我记错了
  2. 密码登录记得设备认证 如何获得滑动验证码 ticket #310

确实是设备认证的问题,现在成功解决了。万分感谢!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants