using System;
using System.Collections.Generic;
namespace TGS.Server.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;
RequiresAdmin = adminOnly;
HelpText = helpText;
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, Helpers.SanitizeTopicString(String.Join(" ", parameters))));
if (res != "SUCCESS" && !String.IsNullOrWhiteSpace(res))
OutputProc(res);
return ExitCode.Normal;
}
}
}