forked from Galactic/galactic-bot
bugfix
This commit is contained in:
parent
79de06d966
commit
a53736e0c3
@ -55,6 +55,7 @@ class ImportCommand extends SlashCommand {
|
|||||||
|
|
||||||
await invoker.reply({ index: 'COMMAND_IMPORT_WORKING', emoji: 'loading' });
|
await invoker.reply({ index: 'COMMAND_IMPORT_WORKING', emoji: 'loading' });
|
||||||
const result = await this[subcommand.name](guild, version, overwrite?.value);
|
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
|
// This looks ridiculous but it's to keep track of what's been imported
|
||||||
// if (!settings.imported) settings.imported = {};
|
// if (!settings.imported) settings.imported = {};
|
||||||
@ -82,8 +83,9 @@ class ImportCommand extends SlashCommand {
|
|||||||
imported = await migrator.import();
|
imported = await migrator.import();
|
||||||
imported.sort((a, b) => a.case - b.case);
|
imported.sort((a, b) => a.case - b.case);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
await migrator.end();
|
||||||
this.client.logger.error(err.stack);
|
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();
|
await migrator.end();
|
||||||
this.client.logger.info(`Imported ${imported.length} infractions in ${guild.name}`);
|
this.client.logger.info(`Imported ${imported.length} infractions in ${guild.name}`);
|
||||||
@ -123,8 +125,9 @@ class ImportCommand extends SlashCommand {
|
|||||||
try {
|
try {
|
||||||
imported = await migrator.import();
|
imported = await migrator.import();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
await migrator.end();
|
||||||
this.client.logger.error(err.stack);
|
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();
|
await migrator.end();
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ class SettingsMigrator {
|
|||||||
enabled: result.invitefilter.enabled,
|
enabled: result.invitefilter.enabled,
|
||||||
actions: []
|
actions: []
|
||||||
};
|
};
|
||||||
const channels = Object.entries(result.invitefilter.channels);
|
const channels = Object.entries(invitefilter.channels || {});
|
||||||
for (const [id, value] of channels) {
|
for (const [id, value] of channels) {
|
||||||
if(value > 0) filter.ignore.push(id);
|
if(value > 0) filter.ignore.push(id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user