Bot goes offline after like a day
I host my discord bot has a file "warn_bot" so I write cd ... then node warn_bot.js the bot works flawlessly but after like 1 day the bot goes offline. I host the bot on my vps, no mess with my vps.
41 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!try using pm2
https://pm2.keymetrics.io
PM2 - Home
Advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management, at a glance.
all i need to type "npm install pm2 -g"?
and then "pm2 start app.js"
since your file is warn_bot.js you'd do "pm2 start warn_bot.js" but yeah
it is online now?
yeah
oh thx!
np
I did this on vps, but doesn't seem to work
what vps are you using??
a swedish hosting site
swehosting
now its not working on my pc also
run "pm2 logs"
see if you find anything
scroll up
wait so you're sure that warn_bot.js is your primary file
or do you have an app.js file
where are your dependencies???
didn't need it
now its working
but the bot is still offline
with 120 restarts
wydm didnt need it
oh
you need discord.js installed to use it
try running npm install discord.js
ok
k now start it
not working
just start it with node and see if it works
because pm2 shouldn't be any different
its working
try just running pm2 kill
& starting it again
mb was doing sth else
run it with the --attach flag
only type —attach flag?
no like
pm2 start [file] --attach
Ok thanks will test when I wake up.
that's just when he tried to start it w "pm2 start warn_bot" without the .js extension i think
No @hey.o is right, you need dependencies installed so that your remote code can import items just like your code does on your development PC. Your bot file does not come bundelled with everything you need.
Oh you might be right, I can't tell which are the VPS terminals and which are the home PC terminals.
i don't think that's the issue anymore
since he can run it with node just fine
but it errors when he tries with pm2
haha yeah
I would like to see the logs output from your warn_bot process. Because it crashed instantly I think it's because you're now calling "C:...\warn_bot" which has no file extension so PM2 cannot resolve it; when you call the file with Node you are appending the '.js' which might be why that works.
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
So what should I do to fix the problem?
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View