From 96d535633a937523a1897551a6a0f0c90c38f4c2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Nov 2025 19:54:53 +0000 Subject: [PATCH] Clear recipients instead of blocking - allow server logging --- Harmony/CHRANIBotTNG.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Harmony/CHRANIBotTNG.cs b/Harmony/CHRANIBotTNG.cs index a4a25e4..f630012 100644 --- a/Harmony/CHRANIBotTNG.cs +++ b/Harmony/CHRANIBotTNG.cs @@ -17,18 +17,19 @@ public class CHRANIBotTNG : IModApi [HarmonyPatch(typeof(GameManager), "ChatMessageServer")] public class ChatMessagePatch { - static bool Prefix(ClientInfo _cInfo, string _msg, List _recipientEntityIds) + static void Prefix(string _msg, ref List _recipientEntityIds) { if (_msg != null && _msg.StartsWith("/bot ")) { - string playerName = _cInfo != null ? _cInfo.playerName : "Server"; - - // Write to server log (visible in telnet) - Console.WriteLine($"Chat (from '{playerName}', entity id '{(_cInfo != null ? _cInfo.entityId.ToString() : "-1")}', to '{(_recipientEntityIds != null && _recipientEntityIds.Count > 0 ? "players" : "all")}'): '{_msg}'"); - - // Block in-game chat display - return false; + // Clear recipients so no players see it in-game, but server still logs it + if (_recipientEntityIds == null) + { + _recipientEntityIds = new List(); + } + else + { + _recipientEntityIds.Clear(); + } } - return true; } } \ No newline at end of file