function buildCommandPattern(string $prefix = null) {
        $pattern = '';
        if($prefix !== null) {
            $escapedPrefix = \preg_quote($prefix, '/');
            $pattern = '/^(<@!?'.$this->client->user->id.'>\s+(?:'.$escapedPrefix.'\s*)?|'.$escapedPrefix.'\s*)([^\s]+)/iu';
        } else {
            $pattern = '/^(<@!?'.$this->client->user->id.'>\s+)([^\s]+)/iu';
        }
        
        $this->commandPatterns[$prefix] = $pattern;
        
        $this->client->emit('debug', 'Built command pattern for prefix "'.$prefix.'": '.$pattern);
        return $pattern;
    }
function buildCommandPattern(string $prefix = null) {
        $pattern = '';
        if($prefix !== null) {
            $escapedPrefix = \preg_quote($prefix, '/');
            $pattern = '/^(<@!?'.$this->client->user->id.'>\s+(?:'.$escapedPrefix.'\s*)?|'.$escapedPrefix.'\s*)([^\s]+)/iu';
        } else {
            $pattern = '/^(<@!?'.$this->client->user->id.'>\s+)([^\s]+)/iu';
        }
        
        $this->commandPatterns[$prefix] = $pattern;
        
        $this->client->emit('debug', 'Built command pattern for prefix "'.$prefix.'": '.$pattern);
        return $pattern;
    }
function buildCommandPattern ( string $ prefix = null ) { $ pattern = '' ; if ( $ prefix !== null ) { $ escapedPrefix = \ preg_quote ( $ prefix , '/' ) ; $ pattern = '/^(<@!?' . $ this -> client -> user -> id . '>\s+(?:' . $ escapedPrefix . '\s*)?|' . $ escapedPrefix . '\s*)([^\s]+)/iu' ; } else { $ pattern = '/^(<@!?' . $ this -> client -> user -> id . '>\s+)([^\s]+)/iu' ; } $ this -> commandPatterns [ $ prefix ] = $ pattern ; $ this -> client -> emit ( 'debug' , 'Built command pattern for prefix "' . $ prefix . '": ' . $ pattern ) ; return $ pattern ; }
Creates a regular expression to match the command prefix and name in a message.
@param string|null  $prefix
@return string
@internal
Creates a regular expression to match the command prefix and name in a message .