Hosting on Repl.it - Glowstudent777/BasicDiscordBot GitHub Wiki
Go to the project dashboard and drag the bot files into the left side of the screen under where it says files
Under create select Node.js
and select Import from GitHub
. Put https://github.com/Glowstudent777/BasicDiscordBot
as the repository url and it should automatically import the files.
In repl.it select the lock icon
To add the bots token in the key
section put CLIENT_TOKEN
Under value
paste the bots token and select Add new secret
Create file called server.js
Open server.js
and type
const express = require('express');
const server = express();
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
module.exports = keepAlive;
Put this at the top of the main.js
const keepAlive = require('./server');
Put keepAlive();
on the line above
client.login(process.env.CLIENT_TOKEN);
It should look like this at this bottom
keepAlive();
client.login(process.env.CLIENT_TOKEN);
To install the dependencies go to the console tab in the project and type
npm i
Install node.js v16 to the repl by executing this command in the Shell
npm init -y && npm i --save-dev node@16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH
Afterwards if you don't already create a file called .replit
and put
run = "npm start"
Then go to Package.json and find scripts
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Add a comma to the end of the test
and put
"start": "node ."
The scripts
should now look like
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ."
},
Now just hit the run button and the bot should come online
you can ping the bot with one of or both of the below options
Go to https://uptimerobot.com/ and setup an account
After you have setup an account go to the dashboard and add a new monitor
Monitor Type
choose HTTP(s)
Friendly Name
is what you want to call the monitor
URL (or IP)
is the web address from the repl.it that says Your bot is alive!
Monitoring Interval
is good at 5 min but can go up to 30 min
After that just select Create Monitor
and choose if you want to be notified when it goes down
Join the Pinglik discord here: https://discord.gg/FpaqZE77UC
After joining the Discord go to https://uptimer.pinglik.eu/ and login with Discord
Go to the dashboard here after logging in: https://uptimer.pinglik.eu/@me
Grab the web address from the repl.it, it is above the browser window that says Your bot is alive!
- Select
Add monitor
-
Monitor Name
can be whatever you want to call the monitor -
Monitor Link
is the link you copied from repl.it -
Ping Interval
can be anywhere from 30 seconds to 5 minutes - Select submit to finish adding the monitor