This commit is contained in:
Erik 2022-06-18 14:23:32 +03:00
parent d5aea865bd
commit 555dc536ce
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

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