v2 is no more

This commit is contained in:
Erik 2023-01-29 19:36:28 +02:00
parent d73d1b4798
commit 63a8c79ec0
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -5,8 +5,6 @@ const { FilterUtil, SettingsMigrator, InfractionMigrator } = require("../../../u
const MemberWrapper = require("./MemberWrapper.js"); const MemberWrapper = require("./MemberWrapper.js");
const configVersion = '3.slash.2'; const configVersion = '3.slash.2';
const { MONGODB_V2_HOST } = process.env;
class GuildWrapper { class GuildWrapper {
constructor(client, guild) { constructor(client, guild) {
@ -104,7 +102,8 @@ class GuildWrapper {
title: this.format('GENERAL_REMINDER_TITLE'), title: this.format('GENERAL_REMINDER_TITLE'),
description: reminder, description: reminder,
color: EmbedDefaultColor color: EmbedDefaultColor
}] }); }]
});
await this.removeCallback(id); await this.removeCallback(id);
} }
@ -155,16 +154,20 @@ class GuildWrapper {
const data = await this.fetchData(); const data = await this.fetchData();
// eslint-disable-next-line prefer-const // eslint-disable-next-line prefer-const
let { settings, _imported } = data; const {
settings,
// _imported
} = data;
const { defaultConfig } = this; const { defaultConfig } = this;
if (!settings && !_imported?.settings && !_imported?.modlogs && process.env.NODE_ENV === 'staging') { // V2 db server is no more, leaving this here if needed again
if (this._importPromise) settings = await this._importPromise; // if (!settings && !_imported?.settings && !_imported?.modlogs && process.env.NODE_ENV === 'staging') {
else { // if (this._importPromise) settings = await this._importPromise;
this._importPromise = this._attemptDataImport(); // else {
settings = await this._importPromise; // this._importPromise = this._attemptDataImport();
} // settings = await this._importPromise;
} // }
// }
if (settings) { if (settings) {
// Ensure new settings properties are propagated to existing configs // Ensure new settings properties are propagated to existing configs
@ -221,7 +224,7 @@ class GuildWrapper {
async _attemptDataImport() { async _attemptDataImport() {
const migratorOptions = { const migratorOptions = {
host: MONGODB_V2_HOST, // host: MONGODB_V2_HOST,
database: 'galacticbot', database: 'galacticbot',
version: '2' version: '2'
}; };