From 608a5b0f5589389ffe1310d878c3ca85f3eab392 Mon Sep 17 00:00:00 2001 From: MrlolDev Date: Sat, 23 Dec 2023 11:06:27 +0100 Subject: [PATCH] fix --- src/bot/utils/settings.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bot/utils/settings.ts b/src/bot/utils/settings.ts index 7344d4f..484978c 100644 --- a/src/bot/utils/settings.ts +++ b/src/bot/utils/settings.ts @@ -533,7 +533,6 @@ export async function getSettingsValue(entry: Guild | User, key: string): Promis if (!entry) return false; if ("roles" in entry) entryType = "users"; else entryType = "guilds"; - if (!entry || !entry.settings_new) { const newSettings = await oldSettingsMigration(entry.settings); if (newSettings) { @@ -546,6 +545,14 @@ export async function getSettingsValue(entry: Guild | User, key: string): Promis } return false; } + if (entry.settings_new.length === 0) { + const newSettings = await getDefaultUserSettings(false); + entry.settings_new = newSettings as SettingCategory[]; + await update(entryType, entry.id, { + settings_new: newSettings, + }); + } + const { collection, id } = key2data(key); const category = entry.settings_new.find((category) => category.name === collection); if (!category) return false;