Ask coding questions

← Back to all posts
keeping bot alive
camckee




using uptimerbot to keep alive but it fails. followed some tutorials,b as soon as i close repl.it tab(s) the bot will go offline. anyone able to help?

Voters
AidenLeonard
camckee
Comments
hotnewtop
camckee

i got it thank you all

silentesc

Make a ".env" file and type in BOT_TOKEN=place your token here

And then remove the first line in your code and just replace it with:

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

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

app.listen(port, () => console.log(Example app listening at http://localhost:${port}));

And then copy your https://GyaradosThief.camckee.repl.co to uptime robot

Coder100

You don't have an HTTP server! You did it wrong!
Add this anywhere to your index.js:

Then, just ping the https://GyaradosThief.camckee.repl.co website that comes up

smh

camckee

@Coder100 is that because of the .env file. i did not have that line on my other bot, but i also did not have an .env file

Coder100
Coder100

btw, make sure you .env file is like:

@camckee

camckee

i have also used https://GyaradosThief.camckee.repl.run for uptimerbot. one more thing why when i open the the url i get a token error but the bot is on the server, and working as long as the repl.it tab is open

Coder100

you did it wrong smh @camckee