I’ve tried all the other things for my bot to work with the dbl webhook but it keeps doing this over and over. I can’t access the event.js either and I don’t know how to fix it.
My project is the-keplerbot
Please help quick,
I’ve tried all the other things for my bot to work with the dbl webhook but it keeps doing this over and over. I can’t access the event.js either and I don’t know how to fix it.
My project is the-keplerbot
Please help quick,
Hello @keplerteddy, welcome to the support forum!
Let me take a look at your code. It sounds like you have more than one piece of code trying to listen to requests on the same port, which is the cause of the error.
Taking a look at your project’s logs, I don’t see this error. When are you getting that message?
I currently commented the stuff out, I’ll uncomment it again.
Ah, I see the error now. If you comment out the code above that’s doing the ‘ping’, the error will go away. You may need to then figure out how to get DBL working at the same time as the ping server though.
It also works if I change the port to 5000 as well…
But then it isn’t connected.
Here is a few pages on the webhooks: https://discordbots.org/api/docs#jslib
and: https://discordbots.org/api/docs#webhooks
Any code running on glitch will need to listen to process.env.PORT
. We only let that port get through.
You may be able to use the arrangement here to do both at the same time: Page cant be found
Hmm I don’t have an server at the moment, what would I set webhookServer to then?
I’ve added the same code that he did, and it seems to still say the exact same thing
you’re calling .listen
on the server twice, you can remove one of those .listen
calls (maybe the one on line 22)
Am I missing process.env.PORT?
Hmm, that seemed to work!
Great! take a look around and see if things are working.
Things are now working! I pressed the test button back at Discord Bot List and the test outputted like it was supposed too!
Thank you so much!
I have the same issue, every time I try to launch my app through the terminal, it throws this error:
events.js:174
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (net.js:1280:14)
at listenInCluster (net.js:1328:12)
at Server.listen (net.js:1415:7)
at Function.listen (/app/node_modules/express/lib/application.js:635:24)
at Object.<anonymous> (/app/index.js:211:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Emitted 'error' event at:
at emitErrorNT (net.js:1307:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! crudsqlite@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the crudsqlite@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npm-cache/10.24.1/_logs/2024-08-29T11_42_32_357Z-debug.log
if it’s that, then the process you run in the terminal and the one that glitch runs automatically will conflict