public Alias(Command command, string alias) : base(true) { TriggerOnChannel = command.TriggerOnChannel; TriggerOnPrivate = command.TriggerOnPrivate; RequiresPrefix = command.RequiresPrefix; ForbidsPrefix = command.ForbidsPrefix; QRequired = command.QRequired; Privilege = command.Privilege; this.alias = alias; this.actual = command; CommandHandler.AddCommand(this); }
public void AddSubCommand(Command sub) { if (subcommands.Contains(sub)) throw new Exception("Duplicate sub command"); subcommands.Add(sub); }
/// <summary> /// Adds a command to the command handler /// </summary> /// <param name="command">The command to add to the command handler</param> public static void AddCommand(Command command) { string keyword = command.GetKeyword().ToLower(); if (commands.ContainsKey(keyword)) throw new Exception("Command with keyword '" + keyword + "' already exists"); commands.Add(keyword, command); if (OnChanged != null) OnChanged.Invoke(); }
/// <summary> /// Adds an alias to the command handler /// </summary> /// <param name="command">The command to alias to</param> /// <param name="alias">The aliassed keyword</param> /// <returns>The new alias</returns> public static Alias AddAlias(Command command, string alias) { return new Alias(command, alias); }