summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authordestruc7i0n <destruc7i0n@users.noreply.github.com>2022-01-03 12:57:18 -0500
committerdestruc7i0n <destruc7i0n@users.noreply.github.com>2022-01-03 12:57:18 -0500
commit3c522c6d58b8fb3cc393a165bbcc98041d94dbe0 (patch)
treeb6aed3856b75682dca6d852efec70e80b3f2d8e9
parent3.2.0 (diff)
downloadshulker-3c522c6d58b8fb3cc393a165bbcc98041d94dbe0.tar.gz
shulker-3c522c6d58b8fb3cc393a165bbcc98041d94dbe0.zip
added debug for webhook ratelimit
-rw-r--r--src/Discord.ts2
-rw-r--r--src/DiscordWebhooks.ts4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Discord.ts b/src/Discord.ts
index 087619b..1245145 100644
--- a/src/Discord.ts
+++ b/src/Discord.ts
@@ -75,7 +75,7 @@ class Discord {
       } else if (this.config.USE_WEBHOOKS) {
         // otherwise, ignore all webhooks that are not the same as this one
         if (this.webhookClient!.id === message.webhookId) {
-          if (this.config.DEBUG) console.log('[INFO] Ignoring webhook from self')
+          if (this.config.DEBUG) console.log('[DEBUG] Ignoring webhook from self')
           return
         }
       }
diff --git a/src/DiscordWebhooks.ts b/src/DiscordWebhooks.ts
index fcdf57f..77f8575 100644
--- a/src/DiscordWebhooks.ts
+++ b/src/DiscordWebhooks.ts
@@ -34,6 +34,10 @@ class DiscordWebhooks {
     this.token = token
 
     this.webhookClient = new WebhookClient({ id, token })
+
+    if (this.config.DEBUG) {
+      this.webhookClient.on('rateLimit', (data) => console.log(`[DEBUG] Webhook is being rate limited. Timeout: ${data.timeout / 1000}s, Limit: ${data.limit}`))
+    }
   }
 
   private parseDiscordWebhook (url: string) {