function registerGroup(...$group) {
        foreach($group as $gr) {
            $oldGr = $gr;
            
            if(!($gr instanceof \CharlotteDunois\Livia\Commands\CommandGroup)) {
                if(!\is_array($gr)) {
                    throw new \InvalidArgumentException('Argument, '.\var_export($gr, true).', is not of type array or an instance of CommandGroup');
                }
                
                if(empty($gr['id']) || empty($gr['name'])) {
                    throw new \InvalidArgumentException('Argument, '.\var_export($gr, true).', is missing at least one require element');
                }
                
                $gr = new \CharlotteDunois\Livia\Commands\CommandGroup($this->client, $gr['id'], $gr['name'], (bool) ($gr['guarded'] ?? false));
            }
            
            if(!($gr instanceof \CharlotteDunois\Livia\Commands\CommandGroup)) {
                throw new \RuntimeException(\var_export($oldGr, true).' is not an array, with id and name elements, or an instance of CommandGroup');
            }
            
            if($this->groups->has($gr->id)) {
                throw new \RuntimeException('Can not register another command group with the ID '.$gr->id);
            }
            
            $this->groups->set($gr->id, $gr);
            
            $this->client->emit('debug', 'Registered group '.$gr->id);
            $this->client->emit('groupRegister', $gr, $this);
        }
        
        return $this;
    }
function registerGroup(...$group) {
        foreach($group as $gr) {
            $oldGr = $gr;
            
            if(!($gr instanceof \CharlotteDunois\Livia\Commands\CommandGroup)) {
                if(!\is_array($gr)) {
                    throw new \InvalidArgumentException('Argument, '.\var_export($gr, true).', is not of type array or an instance of CommandGroup');
                }
                
                if(empty($gr['id']) || empty($gr['name'])) {
                    throw new \InvalidArgumentException('Argument, '.\var_export($gr, true).', is missing at least one require element');
                }
                
                $gr = new \CharlotteDunois\Livia\Commands\CommandGroup($this->client, $gr['id'], $gr['name'], (bool) ($gr['guarded'] ?? false));
            }
            
            if(!($gr instanceof \CharlotteDunois\Livia\Commands\CommandGroup)) {
                throw new \RuntimeException(\var_export($oldGr, true).' is not an array, with id and name elements, or an instance of CommandGroup');
            }
            
            if($this->groups->has($gr->id)) {
                throw new \RuntimeException('Can not register another command group with the ID '.$gr->id);
            }
            
            $this->groups->set($gr->id, $gr);
            
            $this->client->emit('debug', 'Registered group '.$gr->id);
            $this->client->emit('groupRegister', $gr, $this);
        }
        
        return $this;
    }
function registerGroup ( ... $ group ) { foreach ( $ group as $ gr ) { $ oldGr = $ gr ; if ( ! ( $ gr instanceof \ CharlotteDunois \ Livia \ Commands \ CommandGroup ) ) { if ( ! \ is_array ( $ gr ) ) { throw new \ InvalidArgumentException ( 'Argument, ' . \ var_export ( $ gr , true ) . ', is not of type array or an instance of CommandGroup' ) ; } if ( empty ( $ gr [ 'id' ] ) || empty ( $ gr [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'Argument, ' . \ var_export ( $ gr , true ) . ', is missing at least one require element' ) ; } $ gr = new \ CharlotteDunois \ Livia \ Commands \ CommandGroup ( $ this -> client , $ gr [ 'id' ] , $ gr [ 'name' ] , ( bool ) ( $ gr [ 'guarded' ] ?? false ) ) ; } if ( ! ( $ gr instanceof \ CharlotteDunois \ Livia \ Commands \ CommandGroup ) ) { throw new \ RuntimeException ( \ var_export ( $ oldGr , true ) . ' is not an array, with id and name elements, or an instance of CommandGroup' ) ; } if ( $ this -> groups -> has ( $ gr -> id ) ) { throw new \ RuntimeException ( 'Can not register another command group with the ID ' . $ gr -> id ) ; } $ this -> groups -> set ( $ gr -> id , $ gr ) ; $ this -> client -> emit ( 'debug' , 'Registered group ' . $ gr -> id ) ; $ this -> client -> emit ( 'groupRegister' , $ gr , $ this ) ; } return $ this ; }
Registers a group. Emits a groupRegister event for each group.
@param \CharlotteDunois\Livia\Commands\CommandGroup|array  ...$group  An instance of CommandGroup or an associative array `[ 'id' => string, 'name' => string, 'guarded' => bool ]`. Guarded is optional, defaults to false.
@return $this
@throws \RuntimeException
@throws \InvalidArgumentException
@see \CharlotteDunois\Livia\Commands\CommandGroup
Registers a group . Emits a groupRegister event for each group .