[英]How to fix? Discord.js Bot keeps going offline because of Value error
[英]JavaScript discord bot keeps going offline with keep alive
我有一个 Javascript discord 机器人,它越来越大,问题是每次我关闭我的 replit。 大约 30 分钟后,我的机器人就离线了。 我在我的 keep_alive.js 文件中使用此代码
http.createServer(function (req, res) {
res.write("Online:)");
res.end();
}).listen(8080);```
//I have this in index.js: `const keep_alive = require('./keep_alive.js')`
我找到并使用(而且是免费的)的最佳解决方案是 pm2。 它根本不需要您的文件中的代码
npm i pm2 -g
// navigate to the folder with your main bot.js file (in this example it is called index.js)
pm2 start index.js
// followed by
pm2 save
// Optionally you can monitor the whole server as well with
pm2-server-monit
还带有一个免费的仪表板
如果你使用 replit 或类似的东西,你可以使用刷新来保持机器人在线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.