/// <summary> /// Executes the commands /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tcb_CommandExecute(object sender, CommandExecuteEventArgs e) { if (!BotFile.EnableCommands) { return; } //if (!IsWhisper && OnlyAllowWhisperCommands) return; Console.WriteLine("Executing {0}. Whisper: {1}", e.Command, e.IsWhisper); // TextCommands. foreach (TextCommand tc in BotFile.TextCommands) { if (tc.Command == e.Command) { if (tc.MayExecute(e.Permission)) { if (e.IsWhisper) { Tcb.SendWhisperMessage(e.Nick, tc.Format(e)); } else { Tcb.SendChatMessage(tc.Format(e)); } } return; } } foreach (ChatCommand cc in Commands) { if (cc.Command == e.Command) { String Output = cc.Execute(this, e); if (String.IsNullOrEmpty(Output)) { return; } if (e.IsWhisper) { Tcb.SendWhisperMessage(e.Nick, Output); } else { Tcb.SendChatMessage(Output); } return; } } }