mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Remove REST request debug logging
This commit is contained in:
parent
329cd05652
commit
c86abb04a0
1 changed files with 0 additions and 21 deletions
|
@ -1,5 +1,4 @@
|
|||
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";
|
||||
// Always use UTC internally
|
||||
|
@ -22,26 +21,6 @@ import { errorMessage, isDiscordAPIError, isDiscordHTTPError, SECONDS, successMe
|
|||
import { loadYamlSafely } from "./utils/loadYamlSafely";
|
||||
import { DecayingCounter } from "./utils/DecayingCounter";
|
||||
|
||||
// === START REST DEBUG ===
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
const APIRequest = require("discord.js/src/rest/APIRequest.js");
|
||||
|
||||
const dateStr = new Date().toISOString().replace(/[:.]/g, "-");
|
||||
const restDebugFile = path.join("../debug", `rest_${dateStr}.log`);
|
||||
fs.writeFileSync(restDebugFile, "");
|
||||
|
||||
const originalMake = APIRequest.prototype.make;
|
||||
// tslint:disable-next-line:only-arrow-functions
|
||||
APIRequest.prototype.make = function(...args) {
|
||||
const debugInfo = `${new Date().toISOString()} ${this.method.toUpperCase()} ${this.route}`;
|
||||
fs.appendFileSync(restDebugFile, debugInfo + "\n", { encoding: "utf8" });
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`[API REQUEST] ${this.method} ${this.route}`);
|
||||
return originalMake.call(this, ...args);
|
||||
};
|
||||
// === END REST DEBUG ===
|
||||
|
||||
if (!process.env.KEY) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.error("Project root .env with KEY is required!");
|
||||
|
|
Loading…
Add table
Reference in a new issue