From 49a0b9dd89cb193d475400b84634ceeb8f644eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20B=C3=BCchner?= Date: Fri, 27 Sep 2024 15:16:39 +0200 Subject: [PATCH] add sender to report message --- nsfwbot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nsfwbot.py b/nsfwbot.py index b21dbe9..a2d172f 100644 --- a/nsfwbot.py +++ b/nsfwbot.py @@ -116,7 +116,7 @@ class NSFWModelPlugin(Plugin): return results = await self.process_images([evt.content.url]) matrix_to_url = self.create_matrix_to_url(evt.room_id, evt.event_id) - response = self.format_response(results, matrix_to_url) + response = self.format_response(results, matrix_to_url, evt.sender) await self.send_responses(evt, response, results) except Exception as e: self.log.error(f"Error handling image message: {e}") @@ -156,7 +156,7 @@ class NSFWModelPlugin(Plugin): for _, temp_filename in temp_files: os.remove(temp_filename) - def format_response(self, results: dict, matrix_to_url: str) -> str: + def format_response(self, results: dict, matrix_to_url: str, sender: str) -> str: """ Format the response message based on the results. @@ -171,7 +171,8 @@ class NSFWModelPlugin(Plugin): detection_info = ( f"{mxc_url} contains {detection['class']} " f"with a score of {detection['score']:.2f} " - f"in {matrix_to_url}" + f"in {matrix_to_url} " + f"by {sender}" ) response_parts.append(detection_info) break