Patch GameManager.ChatMessage instead of ChatMessageServer

This should properly intercept and block /bot messages from appearing in chat
This commit is contained in:
Claude
2025-11-23 18:18:23 +00:00
parent 6e856a6216
commit b41951e4e1

View File

@@ -1,6 +1,5 @@
using HarmonyLib; using HarmonyLib;
using System.Reflection; using System.Reflection;
using System.Collections.Generic;
using System; using System;
public class BotCommandMod : IModApi public class BotCommandMod : IModApi
@@ -14,11 +13,10 @@ public class BotCommandMod : IModApi
} }
} }
[HarmonyPatch(typeof(GameManager))] [HarmonyPatch(typeof(GameManager), "ChatMessage")]
[HarmonyPatch("ChatMessageServer")]
public class ChatMessagePatch public class ChatMessagePatch
{ {
static bool Prefix(ClientInfo _cInfo, EChatType _type, int _senderId, string _msg, string _mainName, bool _localizeMain, List<int> _recipientEntityIds) static bool Prefix(ClientInfo _cInfo, EChatType _type, string _msg, string _playerName)
{ {
if (_msg != null && _msg.StartsWith("/bot ")) if (_msg != null && _msg.StartsWith("/bot "))
{ {