- miscellaneous small fixes

- add support for preventing all commands to be run on the channel by default. Now TechBot only answers some of the commands in PM
- add back the error Command

svn path=/trunk/; revision=34079
This commit is contained in:
Marc Piulachs 2008-06-25 13:23:59 +00:00
parent b7525df85d
commit a46601a21c
8 changed files with 63 additions and 578 deletions

View file

@ -21,6 +21,11 @@ namespace TechBot.Library
set { m_Context = value; }
}
public virtual bool AnswerInPublic
{
get { return false; }
}
public string Name
{
get
@ -53,6 +58,25 @@ namespace TechBot.Library
TechBot.ServiceOutput.WriteLine(Context, String.Format(format, args));
}
public void Run()
{
if (Context is ChannelMessageContext)
{
if (AnswerInPublic)
{
ExecuteCommand();
}
else
{
Say("Sorry, I only respond '{0}' in private , PM me!", Name);
}
}
else
{
ExecuteCommand();
}
}
public abstract void ExecuteCommand();
public virtual void Initialize()

View file

@ -6,8 +6,6 @@ namespace TechBot.Library
{
public abstract class XmlLookupCommand : XmlCommand
{
protected string m_Text = null;
public virtual string Text
{
get { return Parameters; }