commit d344ea0e1c2a7861c735fbcc3f4c8be1b8b22d97 Author: Claude Date: Sun Nov 23 17:15:09 2025 +0000 Add basic bot command mod - Intercepts chat messages starting with /bot - Logs them to telnet only - Prevents display in game chat diff --git a/Harmony/BotCommandPatch.cs b/Harmony/BotCommandPatch.cs new file mode 100644 index 0000000..4961854 --- /dev/null +++ b/Harmony/BotCommandPatch.cs @@ -0,0 +1,28 @@ +using HarmonyLib; +using System.Reflection; + +public class BotCommandMod : IModApi +{ + public void InitMod(Mod _modInstance) + { + Log.Out("[BotCommandMod] Loading"); + var harmony = new Harmony("com.botcommand.mod"); + harmony.PatchAll(Assembly.GetExecutingAssembly()); + Log.Out("[BotCommandMod] Loaded"); + } +} + +[HarmonyPatch(typeof(ChatCommandManager))] +[HarmonyPatch("ExecuteCommand")] +public class ChatCommandPatch +{ + static bool Prefix(string _command, ClientInfo _cInfo) + { + if (_command != null && _command.StartsWith("/bot ")) + { + Log.Out($"[Bot] {(_cInfo != null ? _cInfo.playerName : "Server")}: {_command}"); + return false; + } + return true; + } +} diff --git a/ModInfo.xml b/ModInfo.xml new file mode 100644 index 0000000..c070ccf --- /dev/null +++ b/ModInfo.xml @@ -0,0 +1,9 @@ + + + + + + + + +