@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!