diff --git a/src/structure/components/commands/administration/Import.js b/src/structure/components/commands/administration/Import.js index cd1586c..00a7731 100644 --- a/src/structure/components/commands/administration/Import.js +++ b/src/structure/components/commands/administration/Import.js @@ -55,6 +55,7 @@ class ImportCommand extends SlashCommand { await invoker.reply({ index: 'COMMAND_IMPORT_WORKING', emoji: 'loading' }); const result = await this[subcommand.name](guild, version, overwrite?.value); + if(result.error) return result; // This looks ridiculous but it's to keep track of what's been imported // if (!settings.imported) settings.imported = {}; @@ -82,8 +83,9 @@ class ImportCommand extends SlashCommand { imported = await migrator.import(); imported.sort((a, b) => a.case - b.case); } catch (err) { + await migrator.end(); this.client.logger.error(err.stack); - return { index: 'COMMAND_IMPORT_ERROR', params: { message: err.message }, emoji: 'failure' }; + return { error: true, index: 'COMMAND_IMPORT_ERROR', params: { message: err.message }, emoji: 'failure' }; } await migrator.end(); this.client.logger.info(`Imported ${imported.length} infractions in ${guild.name}`); @@ -123,8 +125,9 @@ class ImportCommand extends SlashCommand { try { imported = await migrator.import(); } catch (err) { + await migrator.end(); this.client.logger.error(err.stack); - return { index: 'COMMAND_IMPORT_ERROR', params: { message: err.message }, emoji: 'failure' }; + return { error: true, index: 'COMMAND_IMPORT_ERROR', params: { message: err.message }, emoji: 'failure' }; } await migrator.end(); diff --git a/src/utilities/SettingsMigrator.js b/src/utilities/SettingsMigrator.js index 36bfbef..417d7a0 100644 --- a/src/utilities/SettingsMigrator.js +++ b/src/utilities/SettingsMigrator.js @@ -397,7 +397,7 @@ class SettingsMigrator { enabled: result.invitefilter.enabled, actions: [] }; - const channels = Object.entries(result.invitefilter.channels); + const channels = Object.entries(invitefilter.channels || {}); for (const [id, value] of channels) { if(value > 0) filter.ignore.push(id); }