Closed PicklePenger closed 3 years ago
Not to mention, the status of the bot displays as such...
The name is different than displayed as the console simply because I gave it a nickname in the Discord client. This occurs with or without the nickname applied.
Looks like mcapi.ca is down. Unfortunately not directly interchangeable with mcapi.us as they have a different url request format & I believe the responses are different too.
For ex the request url for mcapi.ca was: https://mcapi.ca/ping/all/mc.hypixel.net:25565 While mcapi.us is: https://mcapi.us/server/status?ip=mc.hypixel.net&port=25565
So the bot will need to be modified a bit to work with mcapi.us I originally tried using mcapi.us but ran into rate limit issues
Okay, upon further examination, 'clean' shows up a few times in the JavaScript when referring to the MOTD and it says it is undefined. mcapi.us must use different values that aren't defined as such... That's unfortunate.
Can confirm. By rewriting body.players.online to body.players.now in the JavaScript, adjust for mcapi.us, the bot now displays this:
That is because the value is now defined.
Yeah, there's a few changes like that that need to be made to make it compatible with mcapi.us.
Just did a quick edit, for the most part, this app.js should work: app.zip
Oh, thank you. I had already edited myself but I'll keep that as a backup. Thanks for the help.
No worries! Thanks for informing me of the issue.
Not sure if mcapi.ca is coming back, looks like the maintainer of that project is MIA. I should probably update this repo to use mcapi.us instead.
It likely isn't, it seems. Thank you so much, though, as that updated script works perfectly. This bot was exactly what I was looking for and I'm glad the issue was able to be resolved!
D:\My Stuff\Discord Bots\Server Status\minecraft-server-status-bot>node app.js Ready. Logged as Server Status#3855. Updating bot status (node:5280) UnhandledPromiseRejectionWarning: FetchError: request to https://mcapi.ca/ping/all/173.3.187.18225565 failed, reason: getaddrinfo ENOTFOUND mcapi.ca at ClientRequest.<anonymous> (D:\My Stuff\Discord Bots\Server Status\minecraft-server-status-bot\node_modules\node-fetch\lib\index.js:1461:11) at ClientRequest.emit (events.js:315:20) at TLSSocket.socketErrorListener (_http_client.js:469:9) at TLSSocket.emit (events.js:315:20) at emitErrorNT (internal/streams/destroy.js:106:8) at emitErrorCloseNT (internal/streams/destroy.js:74:3) at processTicksAndRejections (internal/process/task_queues.js:80:21) (Use
node --trace-warnings ...to show where the warning was created) (node:5280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:5280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I followed the directions exactly yet I get this error.