protected function parseMessage(\CharlotteDunois\Yasmin\Models\Message $message) {
        // Find the command to run by patterns
        foreach($this->client->registry->commands as $command) {
            if($command->patterns === null) {
                continue;
            }
            
            foreach($command->patterns as $ptrn) {
                \preg_match($ptrn, $message->content, $matches);
                if(!empty($matches)) {
                    return (new \CharlotteDunois\Livia\Commands\Context($this->client, $message, $command, null, $matches));
                }
            }
        }
        
        $prefix = $this->client->getGuildPrefix($message->guild);
        if(empty($this->commandPatterns[$prefix])) {
            $this->buildCommandPattern($prefix);
        }
        
        $cmdMessage = $this->matchDefault($message, $this->commandPatterns[$prefix], 2);
        if(!$cmdMessage && $message->guild === null) {
            $cmdMessage = $this->matchDefault($message, '/^([^\s]+)/i');
        }
        
        return $cmdMessage;
    }
protected function parseMessage(\CharlotteDunois\Yasmin\Models\Message $message) {
        // Find the command to run by patterns
        foreach($this->client->registry->commands as $command) {
            if($command->patterns === null) {
                continue;
            }
            
            foreach($command->patterns as $ptrn) {
                \preg_match($ptrn, $message->content, $matches);
                if(!empty($matches)) {
                    return (new \CharlotteDunois\Livia\Commands\Context($this->client, $message, $command, null, $matches));
                }
            }
        }
        
        $prefix = $this->client->getGuildPrefix($message->guild);
        if(empty($this->commandPatterns[$prefix])) {
            $this->buildCommandPattern($prefix);
        }
        
        $cmdMessage = $this->matchDefault($message, $this->commandPatterns[$prefix], 2);
        if(!$cmdMessage && $message->guild === null) {
            $cmdMessage = $this->matchDefault($message, '/^([^\s]+)/i');
        }
        
        return $cmdMessage;
    }
protected function parseMessage ( \ CharlotteDunois \ Yasmin \ Models \ Message $ message ) { // Find the command to run by patterns foreach ( $ this -> client -> registry -> commands as $ command ) { if ( $ command -> patterns === null ) { continue ; } foreach ( $ command -> patterns as $ ptrn ) { \ preg_match ( $ ptrn , $ message -> content , $ matches ) ; if ( ! empty ( $ matches ) ) { return ( new \ CharlotteDunois \ Livia \ Commands \ Context ( $ this -> client , $ message , $ command , null , $ matches ) ) ; } } } $ prefix = $ this -> client -> getGuildPrefix ( $ message -> guild ) ; if ( empty ( $ this -> commandPatterns [ $ prefix ] ) ) { $ this -> buildCommandPattern ( $ prefix ) ; } $ cmdMessage = $ this -> matchDefault ( $ message , $ this -> commandPatterns [ $ prefix ] , 2 ) ; if ( ! $ cmdMessage && $ message -> guild === null ) { $ cmdMessage = $ this -> matchDefault ( $ message , '/^([^\s]+)/i' ) ; } return $ cmdMessage ; }
Parses a message to find details about command usage in it.
@param \CharlotteDunois\Yasmin\Models\Message  $message
@return \CharlotteDunois\Livia\Commands\Context|null
Parses a message to find details about command usage in it .