Repl.it Hosting - HeavenCrafter/Futaba.js GitHub Wiki

Install the required dependency

Install the express npm package Type in console > npm i express

Adding the express server dependency

Go into your main bot file. Add this line: require('./server');

Creating the express server file

Make a new file and call it "server.js" Copy and paste this into the newly made server.js file.

const express = require('express');
const app = express();
const port = 3000;

app.get('/', (req, res) => res.send('Hello World!'));

app.listen(port, () => console.log(`Webserver Started Successfully.`));

Test run it first, you should see in your repl.it console respond with "Webserver Started Successfully" And on top of your console in your Repl.it, a new web browser style window should pop up looking like this. You will absolutely need the link that is on the new browser, DO NOT CLOSE IT YET. If you did close it, refresh and restart your bot.

Repl.it Project Link


Now to make it run 24/7, you can follow the exact way I did for Futaba.js (https://github.com/HeavenCrafter/Futaba.js)

Make an UptimeRobot account

Create a UptimeRobot account first over here. https://uptimerobot.com/

Making a new monitor

Then once you're done, create a new monitor on the UptimeRobot dashboard. You can access your dashboard once you've made a UptimeRobot account. https://uptimerobot.com/dashboard#mainDashboard

The following details will be easy but I'll provide images if you're confused.

Follow these images exactly the way they are for the details required in the new monitor you're making.

UptimeRobot Monitor

Repl.it Project Link

Monitor Type* should always be HTTP(s) because Repl was specifically made for web hosting as well but since Discord.js primarily supports Node.js which is used for web hosting, Repl supports it without any single issues whatsoever.

Friendly Name* can be whatever you want.

URL (or IP)* is absolutely fucking required or else it won't be able to ping your bot to keep it online. Since repl.it will shut down inactive Repls after a set amount of time if no one is using it, it will turn off, which is why we're making a UptimeRobot monitor to constantly ping it to keep it alive 24/7. The URL/IP is the newly open browser link on top of your repl console.

Repl.it Project Link

The box that I've drawn, is the URL. If the link ends with .run, that is NOT the appropriate link, it should always be .co Once you're done, that's it. I want to make it extra clear. If you have any more issues, you can always fork Futaba.js from my GitHub as she is built for Heroku and Repl.it hosting platforms. Another tip is if you know anything about Javascript, HTML/CSS, or anything related to making Express Webservers. You can build a website alongside your Discord.js bot, and even potentially make a dashboard for your bot as well.

Making dashboards are completely out of my knowledge. But if you're interested in making a website just like I did (https://Futabajs.lunardian.repl.co)

You can just read and steal the code off of Futaba.js's Repo on my Github.