From dda7864c1a61580b57147db0f3108527581d9a2b Mon Sep 17 00:00:00 2001 From: Brant Martin Date: Sun, 10 Feb 2019 14:58:31 -0500 Subject: [PATCH] Add !uptime command --- Torch.API/ITorchBase.cs | 2 ++ Torch/Commands/TorchCommands.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Torch.API/ITorchBase.cs b/Torch.API/ITorchBase.cs index b8b2e68..779d004 100644 --- a/Torch.API/ITorchBase.cs +++ b/Torch.API/ITorchBase.cs @@ -154,6 +154,8 @@ namespace Torch.API /// Raised when the server's Init() method has completed. /// event Action Initialized; + + TimeSpan ElapsedPlayTime { get; set; } } /// diff --git a/Torch/Commands/TorchCommands.cs b/Torch/Commands/TorchCommands.cs index 26d676e..30d1a6c 100644 --- a/Torch/Commands/TorchCommands.cs +++ b/Torch/Commands/TorchCommands.cs @@ -290,5 +290,11 @@ namespace Torch.Commands } }, this, TaskContinuationOptions.RunContinuationsAsynchronously); } + + [Command("uptime", "Check how long the server has been online.")] + public void Uptime() + { + Context.Respond(((ITorchServer)Context.Torch).ElapsedPlayTime.ToString()); + } } }