2005-01-15 19:27:25 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
namespace TechBot.Library
|
|
|
|
{
|
|
|
|
public class HelpCommand : BaseCommand, ICommand
|
|
|
|
{
|
|
|
|
private IServiceOutput serviceOutput;
|
|
|
|
private ArrayList commands;
|
|
|
|
|
|
|
|
public HelpCommand(IServiceOutput serviceOutput,
|
|
|
|
ArrayList commands)
|
|
|
|
{
|
|
|
|
this.serviceOutput = serviceOutput;
|
|
|
|
this.commands = commands;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool CanHandle(string commandName)
|
|
|
|
{
|
|
|
|
return CanHandle(commandName,
|
|
|
|
new string[] { "help" });
|
|
|
|
}
|
|
|
|
|
2005-02-16 21:07:55 +00:00
|
|
|
public void Handle(MessageContext context,
|
|
|
|
string commandName,
|
2005-01-15 19:27:25 +00:00
|
|
|
string parameters)
|
|
|
|
{
|
2005-02-16 21:07:55 +00:00
|
|
|
serviceOutput.WriteLine(context,
|
|
|
|
"I support the following commands:");
|
2005-01-15 19:27:25 +00:00
|
|
|
foreach (ICommand command in commands)
|
2005-02-16 21:07:55 +00:00
|
|
|
{
|
|
|
|
serviceOutput.WriteLine(context,
|
|
|
|
command.Help());
|
|
|
|
}
|
2005-01-15 19:27:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string Help()
|
|
|
|
{
|
|
|
|
return "!help";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|