fix: asinine JS spec issue

This commit is contained in:
zkldi
2024-01-16 13:24:03 +00:00
parent 6bff7d2f36
commit 6c05593d82
+11
View File
@@ -10,6 +10,17 @@ import { Client, Intents } from "discord.js";
import { GetLimboChannel } from "utils/misc";
import type { CommandInteraction, SelectMenuInteraction } from "discord.js";
// hack: DiscordJS's endpoints sometimes return bigints that end up in our logger.
// when our logger tries to format that content, JSON.stringify fails.
//
// I personally cannot believe that the spec now made JSON.stringify fallible in such
// a common case. It's kind of absurdly ridiculous. But hey ho; monkey patch our way
// out of it.
// @ts-expect-error hack
BigInt.prototype.toJSON = function toJSON() {
return this.toString();
};
const logger = CreateLayeredLogger(LoggerLayers.client);
export const client = new Client({