JonnyPtn / zomboi

A discord bot for project zomboid multiplayer servers
49 stars 32 forks source link

Error when loading perks. #70

Closed Szarikow closed 4 months ago

Szarikow commented 1 year ago

2023-03-17 21:11:44,918:INFO:zomboi: channel connected 2023-03-17 21:11:44,919:INFO:zomboi: Loading user history... 2023-03-17 21:11:45,548:INFO:zomboi: User history loaded 2023-03-17 21:11:45,549:INFO:zomboi: Loading Perk history... 2023-03-17 21:11:45 ERROR discord.client Ignoring exception in on_ready Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/discord/client.py", line 409, in _run_event await coro(*args, *kwargs) File "/root/zomboi/zomboi.py", line 71, in on_ready await zomboi.add_cog(PerkHandler(zomboi, logPath)) File "/root/zomboi/perks.py", line 16, in init self.loadHistory() File "/root/zomboi/perks.py", line 57, in loadHistory self.handleLog(self.splitLine(line)) File "/root/zomboi/perks.py", line 86, in handleLog hours = re.search(r"Hours Survived: (\d+)", message).group(1) AttributeError: 'NoneType' object has no attribute 'group'

JonnyPtn commented 1 year ago

Seems odd, maybe the game is logging in a different format now - can you upload your perks log?

Szarikow commented 1 year ago

@JonnyPtn Sure.

[19-03-23 14:02:42.701] [Litzuka][6713,5488,0][Login][Hours Survived: 13]. [19-03-23 14:02:42.702] [Litzuka][6713,5488,0][Cooking=0, Fitness=2, Strength=3, Blunt=0, Axe=0, Sprinting=0, Lightfoot=2, Nimble=2, Sneak=2, Woodwork=0, Aiming=0, Reloading=0, Farming=0, Fishing=0, Trapping=0, PlantScavenging=0, Doctor=0, Electricity=0, MetalWelding=0, Mechanics=0, Spear=0, Maintenance=0, SmallBlade=0, LongBlade=0, SmallBlunt=0, Tailoring=0][Hours Survived: 13].

This is PerkLog for one user. There are 2 lines, one with Hours Survived and time, second line is with the actual perklog.

JonnyPtn commented 1 year ago

Yeah both of those lines have text that should match that regex, this error implies there's a log line which doesn't have "Hours Survived" in it - do you see any lines like that?

If not we probably just need to add some better error handling here so it can handle it gracefully and log the unexpected line

Szarikow commented 1 year ago

@JonnyPtn

Well all lines in PerkLog have the "Hours Survived" along with the amount of survived hours in it.

JonnyPtn commented 1 year ago

Yeah as I said, if they all contain that string then this error shouldn't appear, so unless you can debug it we'll just have to add something to handle that error gracefully

Szarikow commented 1 year ago

Alright, will try to work a way around this and will update here if i find any cause of error 👍

Kwoa69 commented 1 year ago

Hello, I got 2 servers ( with same logs files ) I got the same problem but the error appair on one server

Nark0t1k commented 8 months ago

Same issue here Working on Windows OS

[22-12-23 16:59:06.815] [Nark0t1k][10759,9485,0][Login][Hours Survived: 4]. [22-12-23 16:59:06.825] [Nark0t1k][10759,9485,0][Cooking=0, Fitness=3, Strength=9, Blunt=1, Axe=0, Sprinting=0, Lightfoot=0, Nimble=0, Sneak=0, Woodwork=0, Aiming=0, Reloading=0, Farming=0, Fishing=0, Trapping=0, PlantScavenging=0, Doctor=0, Electricity=0, MetalWelding=0, Mechanics=0, Spear=0, Maintenance=0, SmallBlade=0, LongBlade=0, SmallBlunt=0, Tailoring=0, Dancing=0, Meditation=0, Music=0][Hours Survived: 4]. [22-12-23 16:59:54.130] [Nark0t1k][10759,9485,0][Level Changed][Woodwork][1][Hours Survived: 4]. [22-12-23 17:00:02.035] [Nark0t1k][10759,9485,0][Level Changed][Woodwork][2][Hours Survived: 4].

JonnyPtn commented 4 months ago

Going to close this for now - Python version of this bot is deprecated, and the updated version shouldn't have these issues