diff --git a/src/utilities/SettingsMigrator.js b/src/utilities/SettingsMigrator.js index 8a400d5..fd60f55 100644 --- a/src/utilities/SettingsMigrator.js +++ b/src/utilities/SettingsMigrator.js @@ -62,13 +62,13 @@ class SettingsMigrator { } const filter = { [idIdentifier]: this.guild }; - const settings = await this.mongo.findOne(collection, filter); - if (!settings) return Promise.reject(new Error('No old settings found')); + const data = await this.mongo.findOne(collection, filter); + if (!data) return Promise.reject(new Error('No old settings found')); // const { _version } = settings; // if (!_version) return Promise.reject(new Error('Unable to determine configuration version')); - const translated = this[version](settings.settings || settings); + const translated = this[version](data.settings || data); let webhook = null, permissions = null; @@ -78,8 +78,8 @@ class SettingsMigrator { if(webhook) delete webhook._id; if(permissions) delete permissions._id; } else if (version === '2') { - ({ webhook = null } = settings.chatlogs || {}); - const resolved = this.permissions(settings.roles); + ({ webhook = null } = data.settings.chatlogs || {}); + const resolved = this.permissions(data.settings.roles); ({ permissions } = resolved); const { overrideRoles } = resolved;