diff --git a/src/structure/components/commands/administration/Import.js b/src/structure/components/commands/administration/Import.js index 1e6b213..cd1586c 100644 --- a/src/structure/components/commands/administration/Import.js +++ b/src/structure/components/commands/administration/Import.js @@ -4,14 +4,17 @@ const { SlashCommand } = require("../../../interfaces"); const dbs = { '2': process.env.NODE_ENV === 'development' ? 'navybot' : 'galacticbot', - '3': 'newgbot' + 'qa': 'galactic' }; -const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD, MONGODB_V2_HOST } = process.env; +const { MONGODB_QA_HOST, MONGODB_USERNAME, MONGODB_PASSWORD, MONGODB_V2_HOST } = process.env; class ImportCommand extends SlashCommand { constructor(client) { + const importChoices = [{ name: 'v2', value: '2' }]; + if (process.env.NODE_ENV === 'production') importChoices.push({ name: 'qa', value: 'qa' }); + super(client, { name: 'import', description: 'Import old settings & modlogs', @@ -24,10 +27,7 @@ class ImportCommand extends SlashCommand { options: [{ name: 'version', description: 'Which version do you want to import from', - choices: [ - { name: 'v2', value: '2' }, - { name: 'v3', value: '3' } - ] + choices: importChoices }] }, { name: 'modlogs', @@ -35,10 +35,7 @@ class ImportCommand extends SlashCommand { options: [{ name: 'version', description: 'Which version do you want to import from', - choices: [ - { name: 'v2', value: '2' }, - { name: 'v3', value: '3' } - ] + choices: importChoices }, { name: 'overwrite', description: 'Whether any existing logs should be overwritten by the imports. By default new ones are bumped', @@ -54,7 +51,7 @@ class ImportCommand extends SlashCommand { 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'; + version = version?.value || '2'; await invoker.reply({ index: 'COMMAND_IMPORT_WORKING', emoji: 'loading' }); const result = await this[subcommand.name](guild, version, overwrite?.value); @@ -72,10 +69,10 @@ class ImportCommand extends SlashCommand { async modlogs(guild, version, overwrite = false) { const migrator = new InfractionMigrator(this.client, guild, { - host: version === '2' ? MONGODB_V2_HOST : MONGODB_HOST, + host: version === '2' ? MONGODB_V2_HOST : MONGODB_QA_HOST, username: version === '2' ? null : MONGODB_USERNAME, password: MONGODB_PASSWORD, - database: dbs[version], // Default to v3 + database: dbs[version], version }); @@ -114,7 +111,7 @@ class ImportCommand extends SlashCommand { async settings(guild, version) { // const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD } = process.env; const migrator = new SettingsMigrator(this.client, guild, { - host: version === '2' ? MONGODB_V2_HOST : MONGODB_HOST, + host: version === '2' ? MONGODB_V2_HOST : MONGODB_QA_HOST, username: version === '2' ? null : MONGODB_USERNAME, password: MONGODB_PASSWORD, database: dbs[version], // Default to v3