function handleRatelimit(\Psr\Http\Message\ResponseInterface $response, ?\CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface $ratelimit = null, bool $isReactionEndpoint = false) {
        \extract($this->extractRatelimit($response));
        
        if($isReactionEndpoint && !empty($resetTime)) {
            $resetTime = (float) \bcadd(\microtime(true), 0.25);
        }
        
        $global = false;
        if($response->hasHeader('X-RateLimit-Global')) {
            $global = true;
            
            $this->limit = $limit ?? $this->limit;
            $this->remaining = $remaining ?? $this->remaining;
            $this->resetTime = $resetTime ?? $this->resetTime;
            
            if($this->remaining === 0 && $this->resetTime > \microtime(true)) {
                $this->limited = true;
                $this->client->emit('debug', 'Global ratelimit encountered, continueing in '.($this->resetTime - \microtime(true)).' seconds');
            } else {
                $this->limited = false;
            }
        } elseif($ratelimit !== null) {
            $set = $ratelimit->handleRatelimit($limit, $remaining, $resetTime);
            if($set instanceof \React\Promise\ExtendedPromiseInterface) {
                $this->bucketRatelimitPromises[$ratelimit->getEndpoint()] = $set;
            }
        }
        
        $this->loop->futureTick(function () use ($ratelimit, $global, $limit, $remaining, $resetTime) {
            $this->client->emit('ratelimit', array(
                'endpoint' => ($ratelimit !== null ? $ratelimit->getEndpoint() : 'global'),
                'global' => $global,
                'limit' => $limit,
                'remaining' => $remaining,
                'resetTime' => $resetTime
            ));
        });
    }