From 1ee6f45f704880f2f9defbf39847a2e934c27d09 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Nov 2025 19:17:37 +0000 Subject: [PATCH] Try ChatCommandManager.ProcessCommand instead --- Harmony/BotCommandPatch.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Harmony/BotCommandPatch.cs b/Harmony/BotCommandPatch.cs index c9d2e47..8f1d70b 100644 --- a/Harmony/BotCommandPatch.cs +++ b/Harmony/BotCommandPatch.cs @@ -13,17 +13,18 @@ public class BotCommandMod : IModApi } } -[HarmonyPatch(typeof(GameManager), "ChatMessage")] -public class ChatMessagePatch +[HarmonyPatch(typeof(ChatCommandManager), "ProcessCommand")] +public class ChatCommandPatch { - static bool Prefix(ClientInfo _cInfo, EChatType _type, string _msg, string _playerName) + static bool Prefix(ChatCommandManager __instance, string _chatText, ClientInfo _cInfo) { - if (_msg != null && _msg.StartsWith("/bot ")) + if (_chatText != null && _chatText.StartsWith("/bot ")) { string playerName = _cInfo != null ? _cInfo.playerName : "Server"; - Console.WriteLine($"[Bot] {playerName}: {_msg}"); + Console.WriteLine($"[Bot] {playerName}: {_chatText}"); return false; } return true; } } +