From 0a102b1ebcbc2439e2fc2dfafc4f148382aeb901 Mon Sep 17 00:00:00 2001 From: Bobbyperson Date: Thu, 26 Sep 2024 04:18:13 -0400 Subject: [PATCH] feat: Add script error checking to log reader (#59) Checks logs for mention of `SCRIPT ERROR` and prints corresponding lines. --- reaper/cogs/log_reading.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/reaper/cogs/log_reading.py b/reaper/cogs/log_reading.py index f79c5c5..419856e 100644 --- a/reaper/cogs/log_reading.py +++ b/reaper/cogs/log_reading.py @@ -95,6 +95,7 @@ async def on_message(self, message): double_barrel_crash = False mod_problem = False invalid_value = False + script_error = [] crash_counter = 0 filename = None audio_list = [] @@ -243,6 +244,22 @@ async def on_message(self, message): problem_found = True framework_error = True + elif "SCRIPT ERROR" in line: + dm_log.add_field( + name="", + value="SCRIPT ERROR: True", + inline=False, + ) + logger.info("I found a script error!") + problem_found = True + j = i + script_read_failsafe = 15 + while lines[j] != "" and j < i + script_read_failsafe: + # script traceback ends with a blank line, 15 is just a failsafe + script_error.append(lines[j]) + logger.info(lines[j]) + j += 1 + elif ( 'Failed reading masterserver authentication response: encountered parse error "Invalid value."' in line @@ -428,6 +445,14 @@ async def on_message(self, message): inline=False, ) + if script_error: + logger.info("adding field") + problem.add_field( + name="Script Error", + value=f"The following script error was found: \n ```{'\n'.join(script_error)}```\nYou likely have an old or outdated mod. You can try to find it based on the files listed in this part of the log and delete it, or wait for a human to give you more information.", + inline=False, + ) + if mod_problem: if double_barrel_crash: