Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MrlolDev committed Dec 23, 2023
1 parent da16f6c commit 608a5b0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bot/utils/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 608a5b0

Please sign in to comment.