public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { if (!MayExecute(e.Permission)) { return(null); } //if (e.CommandArgs.Length < 1) return GetHelp(mb); String c = (e.CommandArgs.Length >= 1) ? e.CommandArgs[0] : String.Empty; String sc = (e.CommandArgs.Length >= 2) ? e.CommandArgs[1] : String.Empty; String c_ = String.Empty; foreach (ChatCommand cc in mb.GetCommands()) { if (cc.Command == c) { return(cc.GetHelp(mb, sc)); } c_ += cc.Command; if (!(cc == mb.GetCommands().Last())) { c_ += ", "; } } return(String.Format("Available Commands: {0}!", c_)); }
public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { if (!MayExecute(e.Permission)) { return(String.Empty); } return(Format(Output, e)); }
public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { if (e.CommandArgs.Length == 0) { return(GetHelp(mb)); } return(String.Format("Cat. {0}", String.Join(" ", e.CommandArgs))); }
public override string GetHelp(Maoubot mb, String SubCommand = "") { switch (SubCommand) { case "add": return(String.Format("{0}{1} {2} <*command> <*output>", mb.Tcb.CommandChar, this.Command, SubCommand)); case "delete": return(String.Format("{0}{1} {2} <*command>", mb.Tcb.CommandChar, this.Command, SubCommand)); default: return(String.Format("{0}{1} <add|delete|...>", mb.Tcb.CommandChar, this.Command)); } }
public override string GetHelp(Maoubot mb, String SubCommand = "") { switch (SubCommand) { case "delete": return(String.Format("{0}{1} {2} <*Number>", mb.Tcb.CommandChar, this.Command, SubCommand)); case "add": return(String.Format("{0}{1} {2} <*Quote>", mb.Tcb.CommandChar, this.Command, SubCommand)); default: return(String.Format("{0}{1} [#|add|delete]", mb.Tcb.CommandChar, this.Command)); } }
public override String Execute(Maoubot mb, CommandExecuteEventArgs e) { if (e.IsWhisper) { return("This command is not available in whisper mode"); } if (!MayExecute(e.Permission)) { return(String.Empty); } if (e.CommandArgs.Length == 0) { return(GetHelp(mb)); } Random r = new Random(); return(String.Format("{0}: {1}", e.Nick, BallMessages[r.Next(BallMessages.Length)])); }
public override string GetHelp(Maoubot mb, String SubCommand = "") { switch (SubCommand) { case "next": return(String.Format("{0}{1} {2}", mb.Tcb.CommandChar, this.Command, SubCommand)); case "clear": return(String.Format("{0}{1} {2}", mb.Tcb.CommandChar, this.Command, SubCommand)); case "list": return(String.Format("{0}{1} {2}", mb.Tcb.CommandChar, this.Command, SubCommand)); case "addrange": return(String.Format("{0}{1} {2} <*names+>", mb.Tcb.CommandChar, this.Command, SubCommand)); default: return(String.Format("{0}{1} [list|next|clear|addrange]", mb.Tcb.CommandChar, this.Command)); } }
public override String Execute(Maoubot mb, CommandExecuteEventArgs e) { if (this.Permission >= Permission.Subscriber && e.IsWhisper) { return("This command is not available in whisper mode"); } if (!MayExecute(e.Permission)) { return(String.Empty); } if (e.CommandArgs.Length >= 1) { String SubCommand = e.CommandArgs[0]; if (SubCommand == "add") { if (e.CommandArgs.Length >= 3) { String Command = e.CommandArgs[1]; String Text = String.Empty; List <String> t_ = e.CommandArgs.ToList(); t_.RemoveAt(0); // remove the "add"-subcommand t_.RemoveAt(0); // remove the commandname Text = String.Join(" ", t_); // Check if the command already exists.. if (mb.BotFile.UpdateCommand(Command, Text)) { return(String.Format("{0}: Command updated.", e.Nick)); } mb.BotFile.AddCommand(Command, Text); mb.RefreshCommands(); return(String.Format("{0}: Added command", e.Nick)); } else { return(GetHelp(mb, SubCommand)); } } else if (SubCommand == "delete") { if (e.CommandArgs.Length >= 2) { String Command = e.CommandArgs[1]; if (mb.BotFile.DeleteCommand(Command)) { mb.RefreshCommands(); return(String.Format("{0}: Command deleted", e.Nick)); } else { return(String.Format("{0}: Command not found!", e.Nick)); } } else { return(GetHelp(mb, SubCommand)); } } else { return(GetHelp(mb)); } } else { return(GetHelp(mb)); } }
public override string GetHelp(Maoubot mb, String SubCommand = "") { return(String.Format("{0}{1}", mb.Tcb.CommandChar, this.Command)); }
public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { return(String.Format("Cheered bits: {0}!", mb.BotFile.CheeredBits)); }
public override string GetHelp(Maoubot mb, String SubCommand = "") { //return "You're funny..."; return(String.Format("{0}{1} <*command>", mb.Tcb.CommandChar, this.Command)); }
public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { if (!MayExecute(e.Permission)) { return(null); } if (e.CommandArgs.Length == 0) { // Add somebody to the queue. if (!Queue.Contains(e.Nick)) { Queue.Add(e.Nick); return(String.Format("{0}: Added you to the queue. Position #{1}", e.Nick, Queue.Count)); } else { return(String.Format("{0}: You're at position #{1} in the queue.", e.Nick, Queue.IndexOf(e.Nick))); } } else { String SubCommand = e.CommandArgs[0]; if (SubCommand == @"list") { String l = "Current queue: "; int names_to_display = 5; for (int i = 0; i < names_to_display && i < Queue.Count; i++) { l += String.Format("{0}", Queue[i]); if (i < Queue.Count - 1 && i < names_to_display - 1) { l += ", "; } } if (Queue.Count > 5) { l += String.Format(" | {0} people left", Queue.Count - 5); } return(l); } else if (SubCommand == @"next") { if (e.Permission >= Permission.Moderator) { if (Queue.Count < 1) { return("The queue is empty. :("); } String NextPerson = Queue[0]; Queue.RemoveAt(0); return(String.Format("Next is: {0}", NextPerson)); } else { return(String.Empty); } } else if (SubCommand == @"clear") { if (e.Permission >= Permission.Moderator) { Queue.Clear(); return("Queue has been cleared."); } else { return(String.Empty); } } else if (SubCommand == @"addrange") { if (e.Permission < Permission.Moderator) { return(null); } List <String> ca = e.CommandArgs.ToList(); ca.RemoveAt(0); ca = String.Join(",", ca).Replace(",,", ",").Split(',').ToList(); foreach (String name in ca) { if (!Queue.Contains(name)) { Queue.Add(name); } else { ca.Remove(name); } } return(String.Format("Added {0} people to the queue. Total: {1}", ca.Count, this.Queue.Count)); } } return(null); }
public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { return(String.Format("New: {0} | Resub: {1}", mb.BotFile.NewSubs, mb.BotFile.Resubs)); }
public override string Execute(Maoubot mb, CommandExecuteEventArgs e) { if (!MayExecute(e.Permission)) { return(null); } if (e.CommandArgs.Length == 0) { if (mb.QuoteFile.Quotes.Length == 0) { return("No quotes found!"); } return(mb.QuoteFile.Quotes[Random.Next(mb.QuoteFile.Quotes.Length)]); } else { // try to get the index int Index = -1; int.TryParse(e.CommandArgs[0], out Index); if (Index > 0) { if (Index < mb.QuoteFile.Amount) { return(mb.QuoteFile.Quotes[Index]); } else { return(String.Format("No quote #{0} found.", Index)); } } if (e.Permission >= Permission.Moderator) { String SubCommand = e.CommandArgs[0]; if (SubCommand == "add") { if (e.CommandArgs.Length >= 2) { List <String> c = e.CommandArgs.ToList(); c.RemoveAt(0); String Quote = String.Join(" ", c); mb.QuoteFile.QuoteList.Add(Quote); mb.SaveQuoteConfig(); return(String.Format("Added quote #{0}.", mb.QuoteFile.Amount)); } else { return(null); } } else if (SubCommand == "delete") { if (e.CommandArgs.Length >= 2) { int.TryParse(e.CommandArgs[1], out Index); if (Index > 0) { if (Index < mb.QuoteFile.Amount) { mb.QuoteFile.QuoteList.RemoveAt(Index); mb.SaveQuoteConfig(); } else { return(String.Format("No quote #{0} found.", Index)); } } else { return(String.Format("Unable to find quote {0}", e.CommandArgs[1])); } } else { return(null); } } } } return(null); }
public abstract String GetHelp(Maoubot mb, String SubCommand = "");
public abstract String Execute(Maoubot mb, CommandExecuteEventArgs e);