You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2022-05-21 01:26:41,323:INFO:zomboi: Loading Perk history...
Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/zomboi/.local/lib/python3.10/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/zomboi/zomboi.py", line 69, in on_ready
zomboi.add_cog(PerkHandler(zomboi, logPath))
File "/home/zomboi/perks.py", line 16, in __init__
self.loadHistory()
File "/home/zomboi/perks.py", line 56, in loadHistory
self.handleLog(*self.splitLine(line))
File "/home/zomboi/perks.py", line 82, in handleLog
hours = re.search(r"Hours Survived: (\d+)", message).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
The text was updated successfully, but these errors were encountered:
After further review; Looks like the regex is fine, it was the trimming of the string that wasn't going as planned. Since the timestamp for the string is handled already.
The issue is on line 62 of perks.py; message = message[message.find("[", 2) + 1 :]
Which should remove everything up to the 2nd square open bracket. Problem is that was intended for the timestamp which is already removed. So it was removing the User. This was a domino effect, causing the "Hours Played" to return "." a period.
So changing line 62 of perks.py to; message = message[message.find("[", 1) + 1 :]
Now it will properly parse the User, Type, and Hours
Bot only handles chat and disconnects. not perks, joins, or deaths.
Maybe something with the regex on line 82 of perks.py
hours = re.search(r"Hours Survived: (\d+)", message).group(1)
The text was updated successfully, but these errors were encountered: