Fix script not showing execution results.

This commit is contained in:
BruceChen 2023-01-15 19:59:57 +08:00
parent 8db0467f69
commit 338f534239
5 changed files with 88 additions and 7 deletions

View file

@ -1,4 +1,5 @@
using System;
using MinecraftClient.CommandHandler;
using MinecraftClient.Scripting;
using Tomlet.Attributes;
using static MinecraftClient.ChatBots.ScriptScheduler.Configs;
@ -191,7 +192,10 @@ namespace MinecraftClient.ChatBots
{
task.Trigger_On_Time_Already_Triggered = true;
LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_time, task.Action));
PerformInternalCommand(task.Action);
CmdResult response = new();
PerformInternalCommand(task.Action, ref response);
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
LogToConsole(response);
}
}
}
@ -209,7 +213,10 @@ namespace MinecraftClient.ChatBots
if (task.Trigger_On_Login || (firstlogin_done == false && task.Trigger_On_First_Login))
{
LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_login, task.Action));
PerformInternalCommand(task.Action);
CmdResult response = new();
PerformInternalCommand(task.Action, ref response);
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
LogToConsole(response);
}
}
@ -229,7 +236,10 @@ namespace MinecraftClient.ChatBots
Settings.DoubleToTick(task.Trigger_On_Interval.MinTime), Settings.DoubleToTick(task.Trigger_On_Interval.MaxTime)
);
LogDebugToConsole(string.Format(Translations.bot_scriptScheduler_running_inverval, task.Action));
PerformInternalCommand(task.Action);
CmdResult response = new();
PerformInternalCommand(task.Action, ref response);
if (response.status != CmdResult.Status.Done || !string.IsNullOrWhiteSpace(response.result))
LogToConsole(response);
}
else task.Trigger_On_Interval_Countdown--;
}