Ejemplo n.º 1
0
 public void RegisterCommand(string command, CommandRights rights)
 {
     if (command == null || command == string.Empty)
     {
         return;
     }
     command = command.ToLower();
     if (!this.Commands.ContainsKey(command))
     {
         CommandRights realRights = new CommandRights();
         realRights.PrivateMessage = rights.PrivateMessage;
         realRights.PrivateChannel = rights.PrivateChannel;
         realRights.Organization   = rights.Organization;
         this.Commands.Add(command, realRights);
     }
 }
Ejemplo n.º 2
0
 public bool Equals(CommandRights obj)
 {
     if (this.Organization != obj.Organization)
     {
         return(false);
     }
     if (this.PrivateChannel != obj.PrivateChannel)
     {
         return(false);
     }
     if (this.PrivateMessage != obj.PrivateMessage)
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Registers an alternative way to access a certain command
        /// </summary>
        /// <param name="alias">The alias to respond to</param>
        /// <param name="command">The real command to trigger</param>
        public void RegisterCommandAlias(string alias, string command)
        {
            if (alias == null || alias == string.Empty)
            {
                return;
            }
            if (command == null || command == string.Empty)
            {
                return;
            }
            alias   = alias.ToLower();
            command = command.ToLower();
            if (this.Commands.ContainsKey(alias) || !this.Commands.ContainsKey(command))
            {
                return;
            }
            CommandRights rights = new CommandRights();

            rights.IsAlias     = true;
            rights.MainCommand = command;
            this.Commands.Add(alias, rights);
        }