Sometimes A2S_INFO returns the incorrect number or players online. I don't know the exact cause, but I believe it is related to mass-disconnects. This then results in DiscordGSM displaying the wrong playercount. We've had a server that crashed and never filled back up for days. It has displayed 35 players online the entire time during that period, despite never having more than 10 players online.
I've recorded this behavior on Squad and Beyond The Wire servers (which use the same codebase) as well as Hell Let Loose. But seeing that this happens on several games that have nothing in common I think it's safe to assume that this happens on more games, if not all.
Now, there is a solution for this. If we query A2S_PLAYER instead we get a list of all connected players. And the response can be quite interesting. Below is an example I recorded when the bot showed that there were 18 players online:
[
{'index': 0, 'name': '', 'kills': 0, 'time': 525896.6875},
{'index': 0, 'name': '', 'kills': 0, 'time': 421503.875},
{'index': 0, 'name': '', 'kills': 0, 'time': 412463.6875},
{'index': 0, 'name': '', 'kills': 0, 'time': 315875.46875},
{'index': 0, 'name': '', 'kills': 0, 'time': 314683.0625},
{'index': 0, 'name': '', 'kills': 0, 'time': 306514.5},
{'index': 0, 'name': '', 'kills': 0, 'time': 304662.25},
{'index': 0, 'name': '', 'kills': 0, 'time': 304572.625},
{'index': 0, 'name': '', 'kills': 0, 'time': 299519.15625},
{'index': 0, 'name': '', 'kills': 0, 'time': 259991.65625},
{'index': 0, 'name': '', 'kills': 0, 'time': 238099.953125},
{'index': 0, 'name': '', 'kills': 0, 'time': 71261.09375},
{'index': 0, 'name': '', 'kills': 0, 'time': 59203.9453125},
{'index': 0, 'name': '', 'kills': 0, 'time': 56263.80078125},
{'index': 0, 'name': '', 'kills': 0, 'time': 50282.68359375},
{'index': 0, 'name': '[BWCC] B@NG', 'kills': 0, 'time': 13713.1494140625},
{'index': 0, 'name': '[BWCC] โ๏ธ hydro', 'kills': 0, 'time': 6419.0048828125},
{'index': 0, 'name': 'PAHE The Happy One', 'kills': 0, 'time': 2346.917236328125}
]
As you can see, there are 18 entries in this list. However, only 3 of them are actual players.
To solve the issue, all you'd have to do is query A2S_PLAYER instead of A2S_INFO. Then, count all the entries which don't have an empty name, and return that value instead.