From ef118437f55e61b6e53bf793bc0946bd97909c19 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 18 Aug 2021 23:20:31 +0300 Subject: [PATCH] Fix 429/rate limit logging --- backend/src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index ece94568..2e78e893 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,4 +1,4 @@ -import { Client, Intents, TextChannel, ThreadChannel } from "discord.js"; +import { Client, Constants, Intents, TextChannel, ThreadChannel } from "discord.js"; import yaml from "js-yaml"; import { Knub, PluginError } from "knub"; import { PluginLoadError } from "knub/dist/plugins/PluginLoadError"; @@ -178,8 +178,13 @@ connect().then(async () => { }); client.setMaxListeners(200); - client.on("rateLimit", rateLimitData => { - logger.info(`[429] ${JSON.stringify(rateLimitData)}`); + client.on(Constants.Events.DEBUG, errorText => { + if (!errorText.indexOf("429")) { + return; + } + + // tslint:disable-next-line:no-console + console.warn(errorText); }); client.on("error", err => {