Closed Yell420 closed 2 years ago
Can you check on the latest version?
Latest version still has the same issue, currrently showing 9 survivors with only 5 people online
It shows every player even if they aren't online. It has an "online" column to show whether they are online or not, so perhaps what you're seeing is expected?
I have confirmed through the players tab in-game, and through rcon - the numbers do not match up. currently 7 players, 13 survivors
I'm still not sure which numbers you mean on the bot side - so in-game it only shows online players so I wouldn't expect that to match up with the list of players the bot shows.
Can you show me what the bot is outputting and what you expect it to output instead?
in-game players through rcon currently by using the command "players" Players connected (9): players shown through bot on discord "Playing PZ with 19 survivors"
Ah ok this is the bot status - are you on the latest version?
yes, just updated to the one you put out and still have the same issue
Are you running with any mods? It's hard to say what's going wrong without seeing the logs. The count is just taken from the number of players it sees connected in the logs without disconnecting yet.
Is the output of the !users
command correct?
!users does not work, Ibelieve #8 mentioned this.
Im running 230 ish mods.
Ignoring exception in command users: Traceback (most recent call last): File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "C:\Zomboi\zomboi-master\users.py", line 136, in users await ctx.send( File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\abc.py", line 1065, in send data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\http.py", line 254, in request raise HTTPException(r, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In content: Must be 4000 or fewer in length.
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In content: Must be 4000 or fewer in length.
Same error as the last one for me.
@Bazimek are you still having this problem? I think I wrote some code that might work, but I don't have a server with enough users to test it on and I don't feel like making spoof users
@Bazimek are you still having this problem? I think I wrote some code that might work, but I don't have a server with enough users to test it on and I don't feel like making spoof users
I Will download the new files and I will try it.
@Bazimek are you still having this problem? I think I wrote some code that might work, but I don't have a server with enough users to test it on and I don't feel like making spoof users
So I downloaded the master files again copied them but still the bot is showing wrong number of players and the users command still does not work.
@Bazimek No I mean I haven't pushed anything to this repo but I can give you some code that might fix the users command
Just wanted to confirm that I installed this bot today and see an inconsistency with the number of users online as well. I've done a server wipe and it's showing two people as 'online' through the '!users' command but no one is online currently in game.
I think your issue is unrelated - the !users
command shows all players from the server regardless of whether they're online (there's a column in the output indicating if they are currently online). The issue mentioned here is purely for number of players showing in the bot's presence status
32
I tried this, but the bot is still showing wrong number of online players and the command !users will freeze the bot (maybe because the database is too big for it?)
@Bazimek is there anything outputted in the logs? or could you send your log files please? That fix is only meant for the users command, I didn't fix the player counter
afaik the bot uses the logs to determine whether a player is online or not. Should probably change this to using the rcon command for players instead and just use the logs for stats. You could also try purging your logs to see if it helps the problem
I think it is working, it is just lagged because it is posting the full database of users. I just did not wait the right time. It posted like 25 messages. Maybe it will be better to post only the online ones? And I am sorry I thought that this will fix the bot status too. My bad.
@Bazimek No worries! I think I will edit the PR so that if the characters go over a certain amount, it will just show the online ones
should be able to try again now
And where can I get the changes? I am not a familiar to github much.
Found it! This is really nice feature! But it means to work like that? When I left, I was still in the table.
honestly i have no idea why it's still showing you in there lol. is the data desynced somehow? If you run it again after a little bit, are you still in there?
Still there (40 mins later) but only with Online status: No. But every player is there from the point of start the bot. Only the status is changing, but it is not dissapearing from the table. In my personal opinion it will be better to show only the actual online players atm.
Ahhh I see. Currently I wrote it so if the list of users is greater than 28 (which is about 2 messages from the bot) , then it will only show online users. Did you clear the logs for this server?
Yes I did clear the logs.
That would be the reason why. Once the server has more users log in to it and if that user count is higher than 28, it will only show online users. I'm fine to change it to just online users, but I didn't want to completely remove the functionality to see all users as well since that was the authors initial implementation
Oh thank you. What about making a second command to show all users? !users online? !users all? Just suggestion. But I love also the way that is atm. And what about the totpic of this issue? The player count in bot status?
@Bazimek Done. Updated PR #32 to default to show only online players (can show offline with "!users all"). Also created #34 which will hopefully solve this issue if the logs/users get out of sync.
Oh you are god! So much great stuff in that small time window. Everything seems to be working just flawlessly. This bot starting to be really awesome. Even the bot status were updated immidiately after player joined/leaved. !users only show actual online players. That is really nice! Thank you.
No problem! Was a fun project for me 😁
You are a great developer. The most 2 things what was (and not only me) bothering are seems to be fixed with your code edits. Love the users command now and the bot status.
Thank you! Just realized in #34 I was missing 2 lines but hopefully it should work now. Lmk if anything needs to be fixed with those!
What is that? Because it is working without it for me right now. But I still add it. EDIT // I added it and now I have this errors: 2022-07-22 23:28:15,122:ERROR:zomboi: [Errno 111] Connect call failed ('127.0.0.1', 27015) 2022-07-22 23:28:15,122:ERROR:zomboi: Unable to run players command on rcon -- check rcon options
ohhhh it means your rcon settings are incorrect. you need your host, port, pass for rcon in your .env file. Basically the issue was fixed bc you cleared your logs, but if the status gets messed up again then this should fix it (I hope). If you don't add the rcon settings it won't break anything, but you will see the error every few minutes. I will make it only display the error once when you start the bot in a new commit (sorry about that!)
I have my RCON settings correct. But work this when the server is runing in a docker (Pterodactyl) ?
Hmmm, you could try setting your RCON_HOST variable in .env to the ip of your server instead of localhost. i've found docker works a little differently when it comes to networking. Personally, I host the bot and the server in the same docker container and then just point the bot at "zomboid". I also posted a commit that will make the error stop after only one time if the rcon creds don't work.
Just right now I change the IP from localhost. It says now only Checking rcon to see if the player counter is correct Is there some confirmation message after thic checking message?
There wasn't a confirmation message, but I just added one. Thanks for testing it!
Can you link me again what file I need to change? I am really lost here to finding the edits. NVM // I guess I found it. Seems to be working. Thank you very much.
No problem! let me know if you have any feedback or anything that doesn't work 😁
I have 🤣 I just created https://github.com/JonnyPtn/zomboi/issues/35
Hello, the counter is moving but its never correct and usually off by 3-5 players.
I have 5 players online right now and its showing 8 survivors.. using an earlier build before the docker update, till i can get the env settings resolved.