Question

How do I connect my Repl.it Discord Bot to Digital Ocean to keep the bot running 24/7?

Posted September 17, 2019 548 views
Node.js DigitalOcean

I am making a Discord bot using JS (Node.js to be exact) and Repl.it. When I was setting up the connection between the bot and the code, the article/tutorial that I used (https://www.codementor.io/garethdwyer/building-a-discord-bot-with-node-js-and-repl-it-mm46r1u8y) said that I could keep the bot running using Repl.it by creating a web server, and the bot would keep running, even when the browser was closed. However, what it did not say is that Repl will only keep the bot running for an hour after the browser is closed. I reddit a reddit thread on r/discordapp that said I should use DigitalOcean to keep it running 24/7 and I was just wondering how I would do this and how I would connect it to Repl.it?

Thanks for any help!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

I am not familiar with Repel.it, but what I think you could do is just create a droplet/server with DigitalOcean, then deploy your NodeJS app on that server. That way your app would be available 24/7 as the DigitalOcean’s server would be running and accessible all of the time and it would not depend on your local PC at all.

Here’s a cool tutorial on how to setup NodeJS:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.
Submit an Answer