- miscellaneous small fixes
[reactos.git] / irc / TechBot / TechBot.Library / Commands / Base / Command.cs
index 25c5119..a822e4c 100644 (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()