static function escapeMarkdown(string $text, bool $onlyCodeBlock = false, bool $onlyInlineCode = false) {
        if($onlyCodeBlock) {
            return \preg_replace('/(```)/miu', "\\`\\`\\`", $text);
        }
        
        if($onlyInlineCode) {
            return \preg_replace('/(`)/miu', '\\\\$1', $text);
        }
        
        return \preg_replace('/(\\*|_|`|~)/miu', '\\\\$1', $text);
    }
static function escapeMarkdown(string $text, bool $onlyCodeBlock = false, bool $onlyInlineCode = false) {
        if($onlyCodeBlock) {
            return \preg_replace('/(```)/miu', "\\`\\`\\`", $text);
        }
        
        if($onlyInlineCode) {
            return \preg_replace('/(`)/miu', '\\\\$1', $text);
        }
        
        return \preg_replace('/(\\*|_|`|~)/miu', '\\\\$1', $text);
    }
static function escapeMarkdown ( string $ text , bool $ onlyCodeBlock = false , bool $ onlyInlineCode = false ) { if ( $ onlyCodeBlock ) { return \ preg_replace ( '/(```)/miu' , "\\`\\`\\`" , $ text ) ; } if ( $ onlyInlineCode ) { return \ preg_replace ( '/(`)/miu' , '\\\\$1' , $ text ) ; } return \ preg_replace ( '/(\\*|_|`|~)/miu' , '\\\\$1' , $ text ) ; }
Escapes any Discord-flavour markdown in a string.
@param string  $text            Content to escape.
@param bool    $onlyCodeBlock   Whether to only escape codeblocks (takes priority).
@param bool    $onlyInlineCode  Whether to only escape inline code.
@return string
Escapes any Discord - flavour markdown in a string .