From f5eb192b589bb2ee513abb6bb8656fccd8bd4bda Mon Sep 17 00:00:00 2001 From: Bobbyperson Date: Mon, 23 Sep 2024 11:31:56 -0400 Subject: [PATCH 1/5] fix error when message is in dm --- reaper/cogs/auto_response.py | 3 +++ reaper/cogs/image_response.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/reaper/cogs/auto_response.py b/reaper/cogs/auto_response.py index bd33146..a438de6 100644 --- a/reaper/cogs/auto_response.py +++ b/reaper/cogs/auto_response.py @@ -107,6 +107,9 @@ async def on_message(self, message): datetime.datetime.now(datetime.timezone.utc) - self.last_time ).total_seconds() + if not message.guild: + return + if not ( time_diff > globals.config["general"]["cooldowntime"] or message.channel.id != self.last_channel diff --git a/reaper/cogs/image_response.py b/reaper/cogs/image_response.py index 2847c6e..5bdbce2 100644 --- a/reaper/cogs/image_response.py +++ b/reaper/cogs/image_response.py @@ -225,6 +225,9 @@ async def on_message(self, message): if str(message.author.id) in users: return + if message.guild is None: + return + if not ( str(message.channel.id) in allowed_channels or str(message.channel.name).startswith("ticket") From 15ead2f07015ac3c2f5797980beaa498100bc4e7 Mon Sep 17 00:00:00 2001 From: Bobbyperson Date: Mon, 23 Sep 2024 11:47:23 -0400 Subject: [PATCH 2/5] add script error checking --- reaper/cogs/log_reading.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/reaper/cogs/log_reading.py b/reaper/cogs/log_reading.py index f79c5c5..ef51aa6 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,20 @@ 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 + while lines[j] != "" and j < i + 15: + script_error.append(lines[j]) + logger.info(line[j]) + j += 1 + elif ( 'Failed reading masterserver authentication response: encountered parse error "Invalid value."' in line @@ -428,6 +443,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: From 53f270942efb20913a3e39901fdd8eb008a29bb5 Mon Sep 17 00:00:00 2001 From: Bobbyperson Date: Mon, 23 Sep 2024 13:19:08 -0400 Subject: [PATCH 3/5] consistency oops --- reaper/cogs/image_response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reaper/cogs/image_response.py b/reaper/cogs/image_response.py index 5bdbce2..822b29b 100644 --- a/reaper/cogs/image_response.py +++ b/reaper/cogs/image_response.py @@ -225,7 +225,7 @@ async def on_message(self, message): if str(message.author.id) in users: return - if message.guild is None: + if not message.guild: return if not ( From 59fadb03d1cd50114aa2c039ed00039d52d3d23c Mon Sep 17 00:00:00 2001 From: Bobbyperson Date: Tue, 24 Sep 2024 12:09:26 -0400 Subject: [PATCH 4/5] Update reaper/cogs/log_reading.py Co-authored-by: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> --- reaper/cogs/log_reading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reaper/cogs/log_reading.py b/reaper/cogs/log_reading.py index ef51aa6..1732548 100644 --- a/reaper/cogs/log_reading.py +++ b/reaper/cogs/log_reading.py @@ -255,7 +255,7 @@ async def on_message(self, message): j = i while lines[j] != "" and j < i + 15: script_error.append(lines[j]) - logger.info(line[j]) + logger.info(lines[j]) j += 1 elif ( From 57c1840f554e7bec59f0447928afed6f71ea1554 Mon Sep 17 00:00:00 2001 From: Bobbyperson Date: Tue, 24 Sep 2024 17:36:12 -0400 Subject: [PATCH 5/5] fix magic number --- reaper/cogs/log_reading.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reaper/cogs/log_reading.py b/reaper/cogs/log_reading.py index 1732548..419856e 100644 --- a/reaper/cogs/log_reading.py +++ b/reaper/cogs/log_reading.py @@ -253,7 +253,9 @@ async def on_message(self, message): logger.info("I found a script error!") problem_found = True j = i - while lines[j] != "" and j < i + 15: + 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