forked from Galactic/galactic-bot
bugfix
This commit is contained in:
parent
d5aea865bd
commit
555dc536ce
@ -51,18 +51,18 @@ class ImportCommand extends SlashCommand {
|
||||
|
||||
async execute(invoker, { version, overwrite }) {
|
||||
const { subcommand, guild } = invoker;
|
||||
let settings = await guild.settings();
|
||||
if (!settings._imported) settings._imported = {};
|
||||
if (settings._imported[subcommand.name]) return { emoji: 'failure', index: 'COMMAND_IMPORT_IMPORTED', params: { thing: Util.capitalise(subcommand.name) } };
|
||||
const data = await guild.fetchData();
|
||||
if (!data._imported) data._imported = {};
|
||||
if (data._imported[subcommand.name]) return { emoji: 'failure', index: 'COMMAND_IMPORT_IMPORTED', params: { thing: Util.capitalise(subcommand.name) } };
|
||||
version = version?.value || '3';
|
||||
|
||||
await invoker.reply({ index: 'COMMAND_IMPORT_WORKING', emoji: 'loading' });
|
||||
const result = await this[subcommand.name](guild, version, overwrite?.value);
|
||||
|
||||
// This looks ridiculous but it's to keep track of what's been imported
|
||||
settings = guild._settings;
|
||||
if (!settings.imported) settings.imported = {};
|
||||
settings.imported[subcommand.name] = true;
|
||||
// if (!settings.imported) settings.imported = {};
|
||||
data._imported[subcommand.name] = true;
|
||||
await guild.updateData({ _imported: data._imported });
|
||||
|
||||
result._edit = true;
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user