From f326fe67b1dec620c718e08ad8028abd0a577620 Mon Sep 17 00:00:00 2001 From: bdistin Date: Tue, 28 Aug 2018 18:25:38 -0500 Subject: [PATCH] fix: reactions ratelimits (#2795) * each reaction doesn't have it's own ratelimit * fix hard-coded reset for reacting --- src/rest/APIRouter.js | 1 + src/rest/RequestHandler.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rest/APIRouter.js b/src/rest/APIRouter.js index 830c8501b..678f2fe70 100644 --- a/src/rest/APIRouter.js +++ b/src/rest/APIRouter.js @@ -22,6 +22,7 @@ function buildRoute(manager) { versioned: manager.versioned, route: route.map((r, i) => { if (/\d{16,19}/g.test(r)) return /channels|guilds/.test(route[i - 1]) ? r : ':id'; + if (route[i - 1] === 'reactions') return ':reaction'; return r; }).join('/'), }, options)).catch(error => { diff --git a/src/rest/RequestHandler.js b/src/rest/RequestHandler.js index 1e3128bd0..7275da57a 100644 --- a/src/rest/RequestHandler.js +++ b/src/rest/RequestHandler.js @@ -131,7 +131,7 @@ class RequestHandler { // https://github.com/discordapp/discord-api-docs/issues/182 if (item.request.route.includes('reactions')) { - this.reset = Date.now() + getAPIOffset(serverDate) + 250; + this.reset = new Date(serverDate).getTime() - getAPIOffset(serverDate) + 250; } }