diff --git a/TGServerService/ChatCommands.cs b/TGServerService/ChatCommands.cs
index 01a55eda40..149fb8f72c 100644
--- a/TGServerService/ChatCommands.cs
+++ b/TGServerService/ChatCommands.cs
@@ -5,18 +5,47 @@ using System.Threading;
namespace TGServerService.ChatCommands
{
+ ///
+ /// Metadata about the currently running
+ ///
sealed class CommandInfo
{
+ ///
+ /// If the was invoked by an admin
+ ///
public bool IsAdmin { get; set; }
+ ///
+ /// If the was invoked from an admin chat channel
+ ///
public bool IsAdminChannel { get; set; }
+ ///
+ /// The name of the invoker
+ ///
public string Speaker { get; set; }
+ ///
+ /// A reference to the that runs the that heard the
+ ///
public ServerInstance Server { get; set; }
}
+ ///
+ /// A command heard by a
+ ///
abstract class ChatCommand : Command
{
+ ///
+ /// for the
+ ///
+ public static ThreadLocal CommandInfo { protected get; set; } = new ThreadLocal();
+ ///
+ /// If set to , the cannot be invoked by a non-admin or outside an admin chat channel
+ ///
public bool RequiresAdmin { get; protected set; }
- public static ThreadLocal CommandInfo = new ThreadLocal();
+ ///
+ /// Shorthand for accessing
+ ///
protected ServerInstance Instance { get { return CommandInfo.Value.Server; } }
+
+ ///
public override ExitCode DoRun(IList parameters)
{
if (RequiresAdmin)
@@ -37,9 +66,23 @@ namespace TGServerService.ChatCommands
}
}
+ ///
+ /// s generated by DreamDaemon via the API
+ ///
sealed class ServerChatCommand : ChatCommand
{
+ ///
+ /// The help text for the
+ ///
readonly string HelpText;
+
+ ///
+ /// Construct a
+ ///
+ /// The invocation of the
+ /// The help text of the
+ /// If set to , the cannot be invoked by a non-admin or outside an admin chat channel
+ /// The number of parameters the requires
public ServerChatCommand(string name, string helpText, bool adminOnly, int requiredParameters)
{
Keyword = name;
@@ -48,11 +91,13 @@ namespace TGServerService.ChatCommands
RequiredParameters = requiredParameters;
}
+ ///
public override string GetHelpText()
{
return HelpText;
}
+ ///
protected override ExitCode Run(IList parameters)
{
var res = Instance.SendCommand(String.Format("{0};sender={1};custom={2}", Keyword, CommandInfo.Value.Speaker, Program.SanitizeTopicString(String.Join(" ", parameters))));
@@ -62,8 +107,15 @@ namespace TGServerService.ChatCommands
}
}
+ ///
+ /// The main root chat command
+ ///
sealed class RootChatCommand : RootCommand
{
+ ///
+ /// Construct a
+ ///
+ /// List of s supplied by DreamDaemon
public RootChatCommand(List serverCommands)
{
var tmp = new List { new PRsCommand(), new VersionCommand(), new RevisionCommand(), new ByondCommand(), new KekCommand() };
@@ -74,12 +126,19 @@ namespace TGServerService.ChatCommands
PrintHelpList = true;
}
}
+ ///
+ /// Retrieves the git SHA of the live DreamDaemon code
+ ///
sealed class RevisionCommand : ChatCommand
{
+ ///
+ /// Construct a
+ ///
public RevisionCommand()
{
Keyword = "revision";
}
+ ///
protected override ExitCode Run(IList parameters)
{
var res = Instance.LiveSha();
@@ -91,18 +150,26 @@ namespace TGServerService.ChatCommands
return ExitCode.Normal;
}
+ ///
public override string GetHelpText()
{
return "Prints the current code revision of the repository (not the server)";
}
}
-
+ ///
+ /// Retrieve the installed, staged, or latest availab
+ ///
sealed class ByondCommand : ChatCommand
{
+ ///
+ /// Construct a
+ ///
public ByondCommand()
{
Keyword = "byond";
}
+
+ ///
protected override ExitCode Run(IList parameters)
{
var type = ByondVersion.Installed;
@@ -115,55 +182,84 @@ namespace TGServerService.ChatCommands
return ExitCode.Normal;
}
+ ///
public override string GetHelpText()
{
return "Gets the specified BYOND version";
}
+
+ ///
public override string GetArgumentString()
{
return "[--staged|--latest]";
}
}
+ ///
+ /// Retrieve the current service version
+ ///
sealed class VersionCommand : ChatCommand
{
+ ///
+ /// Construct a
+ ///
public VersionCommand()
{
Keyword = "version";
}
+
+ ///
protected override ExitCode Run(IList parameters)
{
OutputProc(Instance.Version());
return ExitCode.Normal;
}
+ ///
public override string GetHelpText()
{
return "Gets the running service version";
}
}
+ ///
+ /// kek
+ ///
sealed class KekCommand : ChatCommand
{
+ ///
+ /// Construct a
+ ///
public KekCommand()
{
Keyword = "kek";
}
+
+ ///
protected override ExitCode Run(IList parameters)
{
OutputProc("kek");
return ExitCode.Normal;
}
+ ///
public override string GetHelpText()
{
return "kek";
}
}
+ ///
+ /// Retrieve the list of test-merged github pull requests
+ ///
sealed class PRsCommand : ChatCommand
{
+ ///
+ /// Construct a
+ ///
public PRsCommand()
{
Keyword = "prs";
}
+
+ ///
protected override ExitCode Run(IList parameters)
{
var PRs = Instance.MergedPullRequests(out string res);
@@ -184,6 +280,7 @@ namespace TGServerService.ChatCommands
return ExitCode.Normal;
}
+ ///
public override string GetHelpText()
{
return "Gets the currently merged pull requests in the repository";
diff --git a/TGServiceInterface/RootCommand.cs b/TGServiceInterface/RootCommand.cs
index a10832df11..90b26f352e 100644
--- a/TGServiceInterface/RootCommand.cs
+++ b/TGServiceInterface/RootCommand.cs
@@ -6,7 +6,7 @@ namespace TGServiceInterface
///
/// Helper for creating commands that contain sub commands
///
- public class RootCommand : Command
+ public abstract class RootCommand : Command
{
///
/// s further down the tree from this one. Set in Constructor