This commit is contained in:
Erik 2022-07-07 21:15:00 +03:00
parent ea082e5f51
commit d589deac76
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -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;