FlorianSW / discord-player-count-bot

A discord bot that publishes the player count of a game server in the status of the bot user.
MIT License
18 stars 9 forks source link

Auto restart #3

Closed m0edev closed 2 years ago

m0edev commented 2 years ago

When I'm using steam or steam-query and the server goes down for say a minute the bot quits and needs a manual restart. I have found a work around using nodemon but thought it might be a nice addition to add👍

FlorianSW commented 2 years ago

Hmm, it should automatically reconnect already 🤔 Do you have any error messages or crash logs you could share? :)

m0edev commented 2 years ago

Hey thanks for the reply :)

yeah here is the error i get running "steam-query" when the arma server goes offline.


Logged in as Arma 3#8498!
App setup done...
/home/m0edev/bots/arma/node_modules/rxjs/dist/cjs/internal/util/reportUnhandledError.js:13
            throw err;
            ^

Error: Steam did not respond with a single server, aborting the game status extracting.
    at SteamProvider.<anonymous> (/home/m0edev/bots/arma/dist/adapter/steam/steam-provider.js:78:35)
    at step (/home/m0edev/bots/arma/dist/adapter/steam/steam-provider.js:48:23)
    at Object.next (/home/m0edev/bots/arma/dist/adapter/steam/steam-provider.js:29:53)
    at fulfilled (/home/m0edev/bots/arma/dist/adapter/steam/steam-provider.js:20:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)```
FlorianSW commented 2 years ago

Sorry for the late replay here. I changed the behavior and the tool will now try to take these things into consideration. It will now retry to query the server after some time (basically starting with 2 seconds between the call, with up to 30 seconds). All about the tool will retry querying the server or around 3 minutes and 45 seconds. If the server is not getting available again in this timeframe, the tool stops working as before.

Let me know if we need to tweak the timing here a bit or something 👍