Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot crashes when updating the status #3

Closed
Conorjames98 opened this issue May 21, 2023 · 22 comments
Closed

Bot crashes when updating the status #3

Conorjames98 opened this issue May 21, 2023 · 22 comments
Labels
bug Something isn't working

Comments

@Conorjames98
Copy link

Be sure to run "npm install -g typescript" in the root

@emilkrebs
Copy link
Owner

When you run npm i inside of the project directory it should also install typescript for the project but not globally.

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@Conorjames98
Copy link
Author

And yeah npm I didn't install anything I had to install

Discord.js colors.

And also had to run --save-dev @types/node-fetch for type declaration.

@emilkrebs
Copy link
Owner

When I follow the README everything works fine. What node version are you using and how can I replicate this issue?

@emilkrebs
Copy link
Owner

emilkrebs commented May 21, 2023

I sadly can't test the bot currently because I don't have any Nitrado service running

@Conorjames98
Copy link
Author

[18:42:24] Bot is Ready.
[18:42:24] Bot is logged in as Arkitekx AI#5099.
[18:42:24] Bot is running on 2 servers.
[18:42:24] --------------------------------------------------
[18:42:24] Starting Nitrado API Ping...
[18:42:24] Ping to Nitrado API was successful.
[18:42:24] Updating status...
[18:42:26] Server started with 11 players online.
[18:42:36] Updating status...
[18:42:54] Server started with 11 players online.
[18:43:4] Updating status...
[18:43:13] Server started with 11 players online.
[18:43:23] Updating status...

and it continues to do this until it fails to connect I was wondering is there a need for the repeated updating status?

@emilkrebs
Copy link
Owner

It repeats to update the status so you can view the number of players playing on the server on the bots status.

@emilkrebs
Copy link
Owner

setTimeout(scheduleAsync, 10000);

this line controls the updating delay (currently 10s)

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@emilkrebs
Copy link
Owner

What error message do you get?

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@emilkrebs
Copy link
Owner

Does it provide any error code like 504?

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@emilkrebs
Copy link
Owner

It seems like NitrAPI has some limitations which don't get handled.

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@emilkrebs
Copy link
Owner

Yes, maybe turn off the status updates for now. I can't fix it currently but I am open if you have any suggestions for fixing this problem.

@emilkrebs emilkrebs added the bug Something isn't working label May 21, 2023
@emilkrebs emilkrebs changed the title typescript required Bot crashes when updating the status May 21, 2023
@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@emilkrebs
Copy link
Owner

Thats nice! You could push your changes into a separate branch and create a Pull Request.

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@Conorjames98
Copy link
Author

Conorjames98 commented May 21, 2023 via email

@Conorjames98
Copy link
Author

if anyone else has the same issue when the api fails to connect every 10 seconds change line 43 to

setTimeout(scheduleAsync, 200000);

this will only update players every 10 minutes. (alternatively add error handling so the bot doesn't terminate the program.)

it's important to note that my connection might not be perfect and this could be an issue unique to me but nonetheless the solution worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants