@hyperneutrino/djs-lite 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +6 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -46,6 +46,10 @@ type WrapperConfig<R extends Record<string, Handleable>> = {
|
|
|
46
46
|
[K in keyof R]?: Wrapper<Handler<R[K]>>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
function serialize(object: unknown) {
|
|
50
|
+
return JSON.stringify(object, (_, v) => (typeof v === "bigint" ? v.toString() : v));
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
/**
|
|
50
54
|
* This is the type of `config.wrappers` in {@link loadCommands}. This type is exported so that you can expose the wrappers upstream if you are making a library
|
|
51
55
|
* surrounding this library.
|
|
@@ -367,12 +371,12 @@ export async function loadCommands(client: Client<true>, directory: string, conf
|
|
|
367
371
|
const commandDataHasBeenUpdated = await fs
|
|
368
372
|
.readFile(".cache/command-data.json")
|
|
369
373
|
.then((buffer) => buffer.toString("utf-8"))
|
|
370
|
-
.then((string) =>
|
|
374
|
+
.then((string) => serialize(commandData) !== string)
|
|
371
375
|
.catch(() => true);
|
|
372
376
|
|
|
373
377
|
if (commandDataHasBeenUpdated) {
|
|
374
378
|
await fs.mkdir(".cache", { recursive: true }).catch(() => null);
|
|
375
|
-
await fs.writeFile(".cache/command-data.json",
|
|
379
|
+
await fs.writeFile(".cache/command-data.json", serialize(commandData)).catch(() => null);
|
|
376
380
|
|
|
377
381
|
if (config?.guildId) {
|
|
378
382
|
const testGuild = client.guilds.resolve(config.guildId);
|