mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added a Debug mode setting to the Websocket chat bot.
This commit is contained in:
parent
46e8818b5b
commit
7b19a1137f
2 changed files with 7 additions and 2 deletions
|
|
@ -185,6 +185,9 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
[TomlInlineComment("$config.ChatBot.WebSocketBot.Password$")]
|
||||
public string? Password = "wspass12345";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.WebSocketBot.DebugMode$")]
|
||||
public bool DebugMode = false;
|
||||
}
|
||||
|
||||
public WebSocketBot()
|
||||
|
|
@ -266,7 +269,8 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
try
|
||||
{
|
||||
LogDebugToConsole("\n\n\tGot command\n\n\t" + message + "\n\n");
|
||||
if (Config.DebugMode)
|
||||
LogDebugToConsole("\n\n\tGot command\n\n\t" + message + "\n\n");
|
||||
|
||||
WsChatBotCommand cmd = JsonConvert.DeserializeObject<WsChatBotCommand>(message)!;
|
||||
WsCommandResponder responder = new WsCommandResponder(this, session, cmd.Command, cmd.RequestId);
|
||||
|
|
@ -1119,7 +1123,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
session.SendToClient("{\"event\": \"" + type + "\", \"data\": " + (data.IsNullOrEmpty() ? "null" : "\"" + Json.EscapeString(data) + "\"") + "}");
|
||||
|
||||
if (!(type.Contains("Entity") || type.Equals("OnTimeUpdate") || type.Equals("OnServerTpsUpdate")))
|
||||
if (!(type.Contains("Entity") || type.Equals("OnTimeUpdate") || type.Equals("OnServerTpsUpdate")) && Config.DebugMode)
|
||||
LogDebugToConsole(
|
||||
"\n\n\tSending:\n\n\t{\"event\": \"" + type +
|
||||
"\", \"data\": " + (data.IsNullOrEmpty() ? "null" : "\""
|
||||
|
|
|
|||
|
|
@ -1047,3 +1047,4 @@ config.ChatBot.WebSocketBot=Remotely control the client using Web Sockets.\n# Th
|
|||
config.ChatBot.WebSocketBot.Ip=The IP address that Websocket server will be bounded to.
|
||||
config.ChatBot.WebSocketBot.Port=The Port that Websocket server will be bounded to.
|
||||
config.ChatBot.WebSocketBot.Password=A password that will be used to authenticate on thw Websocket server (It is recommended to change the default password and to set a strong one).
|
||||
config.ChatBot.WebSocketBot.DebugMode=If enabled the chat bot will print what is it recieving and sending when the "DebugMessages" are enabled in "Logging" section. This is useful when making your own library or trying to figure what is wrong with an existing one.
|
||||
Loading…
Add table
Add a link
Reference in a new issue