function registerCommand(...$command) {
        foreach($command as $cmd) {
            if(!($cmd instanceof \CharlotteDunois\Livia\Commands\Command)) {
                if(!\is_string($cmd)) {
                    throw new \InvalidArgumentException('Passed argument, '.\var_export($cmd, true).', is not a string or an instance of Command');
                }
                
                $oldCmd = $cmd;
                
                $cmd = $this->handleCommandSpacing($cmd);
                if(!\is_callable($cmd)) {
                    throw new \RuntimeException('Unable to resolve '.$oldCmd.' to an anonymous function');
                }
                
                $cmd = $cmd($this->client);
                if(!($cmd instanceof \CharlotteDunois\Livia\Commands\Command)) {
                    throw new \RuntimeException('Anonymous function in '.$oldCmd.' does not return an instance of Command');
                }
            }
            
            if($this->commands->has($cmd->name)) {
                throw new \RuntimeException('Can not register another command with the name '.$cmd->name);
            }
            
            $this->commands->set($cmd->name, $cmd);
            
            $group = $this->resolveGroup($cmd->groupID);
            if($group) {
                $group->commands->set($cmd->name, $cmd);
            }
            
            $this->client->emit('debug', 'Registered command '.$cmd->groupID.':'.$cmd->name);
            $this->client->emit('commandRegister', $cmd, $this);
        }
        
        return $this;
    }
function registerCommand(...$command) {
        foreach($command as $cmd) {
            if(!($cmd instanceof \CharlotteDunois\Livia\Commands\Command)) {
                if(!\is_string($cmd)) {
                    throw new \InvalidArgumentException('Passed argument, '.\var_export($cmd, true).', is not a string or an instance of Command');
                }
                
                $oldCmd = $cmd;
                
                $cmd = $this->handleCommandSpacing($cmd);
                if(!\is_callable($cmd)) {
                    throw new \RuntimeException('Unable to resolve '.$oldCmd.' to an anonymous function');
                }
                
                $cmd = $cmd($this->client);
                if(!($cmd instanceof \CharlotteDunois\Livia\Commands\Command)) {
                    throw new \RuntimeException('Anonymous function in '.$oldCmd.' does not return an instance of Command');
                }
            }
            
            if($this->commands->has($cmd->name)) {
                throw new \RuntimeException('Can not register another command with the name '.$cmd->name);
            }
            
            $this->commands->set($cmd->name, $cmd);
            
            $group = $this->resolveGroup($cmd->groupID);
            if($group) {
                $group->commands->set($cmd->name, $cmd);
            }
            
            $this->client->emit('debug', 'Registered command '.$cmd->groupID.':'.$cmd->name);
            $this->client->emit('commandRegister', $cmd, $this);
        }
        
        return $this;
    }
function registerCommand ( ... $ command ) { foreach ( $ command as $ cmd ) { if ( ! ( $ cmd instanceof \ CharlotteDunois \ Livia \ Commands \ Command ) ) { if ( ! \ is_string ( $ cmd ) ) { throw new \ InvalidArgumentException ( 'Passed argument, ' . \ var_export ( $ cmd , true ) . ', is not a string or an instance of Command' ) ; } $ oldCmd = $ cmd ; $ cmd = $ this -> handleCommandSpacing ( $ cmd ) ; if ( ! \ is_callable ( $ cmd ) ) { throw new \ RuntimeException ( 'Unable to resolve ' . $ oldCmd . ' to an anonymous function' ) ; } $ cmd = $ cmd ( $ this -> client ) ; if ( ! ( $ cmd instanceof \ CharlotteDunois \ Livia \ Commands \ Command ) ) { throw new \ RuntimeException ( 'Anonymous function in ' . $ oldCmd . ' does not return an instance of Command' ) ; } } if ( $ this -> commands -> has ( $ cmd -> name ) ) { throw new \ RuntimeException ( 'Can not register another command with the name ' . $ cmd -> name ) ; } $ this -> commands -> set ( $ cmd -> name , $ cmd ) ; $ group = $ this -> resolveGroup ( $ cmd -> groupID ) ; if ( $ group ) { $ group -> commands -> set ( $ cmd -> name , $ cmd ) ; } $ this -> client -> emit ( 'debug' , 'Registered command ' . $ cmd -> groupID . ':' . $ cmd -> name ) ; $ this -> client -> emit ( 'commandRegister' , $ cmd , $ this ) ; } return $ this ; }
Registers a command. Emits a commandRegister event for each command.
@param string|\CharlotteDunois\Livia\Commands\Command  ...$command  The full qualified command name (`groupID:name`) or an initiated instance of it.
@return $this
@throws \RuntimeException
@throws \InvalidArgumentException
Registers a command . Emits a commandRegister event for each command .