Page cant be found

What I do to start up my discord bot is go to the webpage. But starting a few days ago, It says that the page can’t be found. I have tried remixing the project but it still says it can’t be found. the link to the page is:
https://tubebot.glitch.me/
is there any way that I can get the webpage working again?

Hi @Powermins, welcome to the Glitch Forums!

I think you’re missing the directive to tell Express to serve your static index.html file. You need app.use(express.static('public')); some time after const app = express(); and before app.get('/', function(request, response).

Hope this helps! Happy Glitching!

is there any way I can change the port from 3000 to 5000? I found out why it was not working. It was the bit where I had const dbl = new DBL(token, { webhookPort: listener, webhookAuth: 'password' }, bot); when I use the listener for the port. the website won’t work. but when I change the port of the website. the website still won’t work.

Random question, but why doesn’t your glitch page ‘tubebot.glitch.me’ or ‘https://glitch.com/edit/#!/tubebot’ exist?

I don’t know the exact reason but whenever using the discord bot list API and putting the listener as the webhook port. it makes the website cease to exist

So are you unable to edit your site?

I won’t be able to edit and see what it looks like live.

@Powermins I don’t know much about DiscordBotList, but I think what you’re trying to do here won’t work.

It looks like what’s happening is that you have Express listening to the open port in your Glitch project to serve your bot’s index.html page and you’re also having DBL listen to the same port (I gather so that you can receive votes, although I’m unsure what that means). That won’t work in Glitch - only one process can listen to a given port at a time and Glitch only provides a single open port (typically port 3000, but that changes under some circumstances which is why we suggest using process.env.PORT, which is automatically managed by Glitch). That’s why your index.html page works fine when you remove the dbl code and stops working when you put it back.

However I think you could use DBL’s webhookServer option (instead of webhookPort) in concert with node’s http server. So after you define your Express app you would use:

var server = require('http').createServer(app);

and then instead of

const listener = app.listen(process.env.PORT, function() {...

you would use

const listener = server.listen(process.env.PORT, function() {...

and when you define your dbl object you would use

const dbl = new DBL(token, { webhookServer: server...

I’ve done this in a remix of your project and got rid of the EADDRINUSE errors and was able to access the index.html file, although I didn’t test to make sure anything was working with the dbl setup.

Also I was mistaken when I talked about adding app.use(express.static('public')); earlier. Since you’re serving a specific file path in app.get("/") you don’t need to set up the static server.

Hope this helps!

1 Like

Thank you! It worked!