function getRatelimitEndpoint(\CharlotteDunois\Yasmin\HTTP\APIRequest $request) {
        $endpoint = $request->getEndpoint();
        
        if($request->isReactionEndpoint()) {
            \preg_match('/channels\/(\d+)\/messages\/(\d+)\/reactions\/.*/', $endpoint, $matches);
            return 'channels/'.$matches[1].'/messages/'.$matches[2].'/reactions';
        }
        
        $firstPart = \substr($endpoint, 0, (\strpos($endpoint, '/') ?: \strlen($endpoint)));
        $majorRoutes = array('channels', 'guilds', 'webhooks');
        
        if(!\in_array($firstPart, $majorRoutes, true)) {
            return $firstPart;
        }
        
        \preg_match('/((?:.*?)\/(?:\d+))(?:\/messages\/((?:bulk(?:-|_)delete)|(?:\d+)){0,1})?/', $endpoint, $matches);
        
        if(\is_numeric(($matches[2] ?? null)) && $request->getMethod() === 'DELETE') {
            return 'delete@'.$matches[0];
        } elseif(\stripos(($matches[2] ?? ''), 'bulk') !== false) {
            return $matches[0];
        }
        
        return ($matches[1] ?? $endpoint);
    }
function getRatelimitEndpoint(\CharlotteDunois\Yasmin\HTTP\APIRequest $request) {
        $endpoint = $request->getEndpoint();
        
        if($request->isReactionEndpoint()) {
            \preg_match('/channels\/(\d+)\/messages\/(\d+)\/reactions\/.*/', $endpoint, $matches);
            return 'channels/'.$matches[1].'/messages/'.$matches[2].'/reactions';
        }
        
        $firstPart = \substr($endpoint, 0, (\strpos($endpoint, '/') ?: \strlen($endpoint)));
        $majorRoutes = array('channels', 'guilds', 'webhooks');
        
        if(!\in_array($firstPart, $majorRoutes, true)) {
            return $firstPart;
        }
        
        \preg_match('/((?:.*?)\/(?:\d+))(?:\/messages\/((?:bulk(?:-|_)delete)|(?:\d+)){0,1})?/', $endpoint, $matches);
        
        if(\is_numeric(($matches[2] ?? null)) && $request->getMethod() === 'DELETE') {
            return 'delete@'.$matches[0];
        } elseif(\stripos(($matches[2] ?? ''), 'bulk') !== false) {
            return $matches[0];
        }
        
        return ($matches[1] ?? $endpoint);
    }
function getRatelimitEndpoint ( \ CharlotteDunois \ Yasmin \ HTTP \ APIRequest $ request ) { $ endpoint = $ request -> getEndpoint ( ) ; if ( $ request -> isReactionEndpoint ( ) ) { \ preg_match ( '/channels\/(\d+)\/messages\/(\d+)\/reactions\/.*/' , $ endpoint , $ matches ) ; return 'channels/' . $ matches [ 1 ] . '/messages/' . $ matches [ 2 ] . '/reactions' ; } $ firstPart = \ substr ( $ endpoint , 0 , ( \ strpos ( $ endpoint , '/' ) ? : \ strlen ( $ endpoint ) ) ) ; $ majorRoutes = array ( 'channels' , 'guilds' , 'webhooks' ) ; if ( ! \ in_array ( $ firstPart , $ majorRoutes , true ) ) { return $ firstPart ; } \ preg_match ( '/((?:.*?)\/(?:\d+))(?:\/messages\/((?:bulk(?:-|_)delete)|(?:\d+)){0,1})?/' , $ endpoint , $ matches ) ; if ( \ is_numeric ( ( $ matches [ 2 ] ?? null ) ) && $ request -> getMethod ( ) === 'DELETE' ) { return 'delete@' . $ matches [ 0 ] ; } elseif ( \ stripos ( ( $ matches [ 2 ] ?? '' ) , 'bulk' ) !== false ) { return $ matches [ 0 ] ; } return ( $ matches [ 1 ] ?? $ endpoint ) ; }
Turns an endpoint path to the ratelimit path.
@param \CharlotteDunois\Yasmin\HTTP\APIRequest  $request
@return string
Turns an endpoint path to the ratelimit path .