Add !uptime command

This commit is contained in:
Brant Martin
2019-02-10 14:58:31 -05:00
parent ddc13cccec
commit dda7864c1a
2 changed files with 8 additions and 0 deletions

View File

@@ -154,6 +154,8 @@ namespace Torch.API
/// Raised when the server's Init() method has completed. /// Raised when the server's Init() method has completed.
/// </summary> /// </summary>
event Action<ITorchServer> Initialized; event Action<ITorchServer> Initialized;
TimeSpan ElapsedPlayTime { get; set; }
} }
/// <summary> /// <summary>

View File

@@ -290,5 +290,11 @@ namespace Torch.Commands
} }
}, this, TaskContinuationOptions.RunContinuationsAsynchronously); }, this, TaskContinuationOptions.RunContinuationsAsynchronously);
} }
[Command("uptime", "Check how long the server has been online.")]
public void Uptime()
{
Context.Respond(((ITorchServer)Context.Torch).ElapsedPlayTime.ToString());
}
} }
} }