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 filter = { [idIdentifier]: this.guild };
const settings = await this.mongo.findOne(collection, filter); const data = await this.mongo.findOne(collection, filter);
if (!settings) return Promise.reject(new Error('No old settings found')); if (!data) return Promise.reject(new Error('No old settings found'));
// const { _version } = settings; // const { _version } = settings;
// if (!_version) return Promise.reject(new Error('Unable to determine configuration version')); // 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, let webhook = null,
permissions = null; permissions = null;
@ -78,8 +78,8 @@ class SettingsMigrator {
if(webhook) delete webhook._id; if(webhook) delete webhook._id;
if(permissions) delete permissions._id; if(permissions) delete permissions._id;
} else if (version === '2') { } else if (version === '2') {
({ webhook = null } = settings.chatlogs || {}); ({ webhook = null } = data.settings.chatlogs || {});
const resolved = this.permissions(settings.roles); const resolved = this.permissions(data.settings.roles);
({ permissions } = resolved); ({ permissions } = resolved);
const { overrideRoles } = resolved; const { overrideRoles } = resolved;