Forums > Javascript >

[TUTORIAL] How to host a JavaScript Discord Bot using UptimeRobot


falseopx

pika

Posts: 200

Threads: 35

Joined: Feb, 2021

Reputation: 7

Posted

[DISCLAIMER]

There are definitely WAY better tutorials out there, 
but this is just a basic tutorial for noobs who
are just starting out with bot development.


How to host a JavaScript Discord Bot using UptimeRobot
A tutorial by falseopx


For this tutorial, I'm using replit.com, a browser based IDE. If you would like a tutorial
on how to make a basic bot in replit, I will make one in the future.

Now to start, you need to install Express, you can do this by going into your console, (or in my case, the Shell tab) and type:

npm install express

And wait for the installation to finish, once the installation has finished, go to your index.js file,
go to the top of your file and then type:

const express = require('express')

This will allow you to use the express module to make an express webserver.
Now it is time to create our webserver, and make sure it works, to do this, simply type:

const wserver = express();
const port = 3000;
wserver.get('/', (r1, r2) => r2.send('webserver online'));

wserver.listen(port, () => console.log(`webserver online`));

Now, press the Run button, you should get a result such as:


Now that we have a webserver up and running, we can get started with uptimerobot.com.


Once you are on uptimerobot.com, Click the 'Register for FREE' button., There should be instructions on the Sign Up page. Follow the instructions and you should be on this screen: 


Once you are on this screen, click on the 'Add New Monitor' button.


Click on 'Please Select', and select HTTPS


Now go back to replit, now go to the area where you have the webserver page, copy the link

And paste it into the 'URL or IP' Box.
Now you dont have anything else to do, but click 'create monitor', you can also check the "emergency contacts" toggle if you want to be notified when your monitor goes down (which is rare)


And then you can press the 'Run' Button on your repl, and Volia! You have a bot on 24/7 hosting! I will post a new thread on how to make a basic discord bot on replit.com soon, dw.
If any JS bot experts spy that i have said or done something wrong, please tell me by discord at falseopx#2012.
thanks!

valet owner and developer | lua script developer and ui designer
join valet | #valetfrontpage (never)

MINISHXP

minishxp#9667

Posts: 1121

Threads: 35

Joined: Jan, 2021

Reputation: 4

Replied

this is a really nice tutorial, (im tying to make a bot rn for my server).

tbh tho i would use python

The Tiananmen Square protests, known as the June Fourth Incident in China (Chinese六四事件pinyinliùsì shìjiàn)

Bones

deez nuts

Posts: 382

Threads: 10

Joined: Mar, 2021

Reputation: 11

Replied

@MINISHXP Stay with Node.JS. The Discord.JS Libary has a lot of functions and is easy to use

Who's Deez?

MINISHXP

minishxp#9667

Posts: 1121

Threads: 35

Joined: Jan, 2021

Reputation: 4

Replied

@Bonesi guess im learning javascript now :cri:

The Tiananmen Square protests, known as the June Fourth Incident in China (Chinese六四事件pinyinliùsì shìjiàn)

Zander7473

Casual Femboy Agent

Posts: 1107

Threads: 32

Joined: Mar, 2020

Reputation: 13

Replied

@Bones

 

If you know about the discord.js library, provide me a couple functions found in the discord.js library

jon likes le tites

Bones

deez nuts

Posts: 382

Threads: 10

Joined: Mar, 2021

Reputation: 11

Replied

@Zander7473 Pretty much didn't use it for the last 6 months because i quit Discord Bot Development, and used the libary for smaller Projects. Anyways here are a few functions i still remember:

premiumTier(), premiumSubscribtionCount(), on(), token(), reply(), send(), forEach(), member()

 

I don't remember a lot, probably going to start another Bot Project soon

Who's Deez?