Add rate limit logging

This commit is contained in:
Dragory 2021-09-12 00:17:26 +03:00
parent 0a00be7a72
commit 57ed43b018
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
4 changed files with 67 additions and 0 deletions

View file

@ -22,6 +22,7 @@ import { loadYamlSafely } from "./utils/loadYamlSafely";
import { DecayingCounter } from "./utils/DecayingCounter";
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
import { logRestCall } from "./restCallStats";
import { logRateLimit } from "./rateLimitStats";
if (!process.env.KEY) {
// tslint:disable-next-line:no-console
@ -317,6 +318,10 @@ connect().then(async () => {
startUptimeCounter();
});
client.on(Constants.Events.RATE_LIMIT, (data) => {
logRateLimit(data);
});
bot.initialize();
logger.info("Bot Initialized");
logger.info("Logging in...");