Update card database to use JSON files #107
2 changed files with 17 additions and 2 deletions
|
@ -4,6 +4,7 @@ import { ExecException, exec } from "child_process";
|
||||||
import CardSetupFunction from "../Functions/CardSetupFunction";
|
import CardSetupFunction from "../Functions/CardSetupFunction";
|
||||||
import { CoreClient } from "../client/client";
|
import { CoreClient } from "../client/client";
|
||||||
import Config from "../database/entities/app/Config";
|
import Config from "../database/entities/app/Config";
|
||||||
|
import CardMetadataFunction from "../Functions/CardMetadataFunction";
|
||||||
|
|
||||||
export default class Gdrivesync extends Command {
|
export default class Gdrivesync extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -33,8 +34,13 @@ export default class Gdrivesync extends Command {
|
||||||
if (error) {
|
if (error) {
|
||||||
await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
|
await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
|
||||||
await Config.SetValue('safemode', 'true');
|
await Config.SetValue('safemode', 'true');
|
||||||
|
} else {
|
||||||
|
if (!(process.env.FEATURE_METADATA && process.env.FEATURE_METADATA == 'true')) {
|
||||||
|
await CardMetadataFunction.Execute();
|
||||||
} else {
|
} else {
|
||||||
await CardSetupFunction.Execute();
|
await CardSetupFunction.Execute();
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.editReply('Synced successfully.');
|
await interaction.editReply('Synced successfully.');
|
||||||
|
|
||||||
CoreClient.AllowDrops = true;
|
CoreClient.AllowDrops = true;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder
|
||||||
import { Command } from "../type/command";
|
import { Command } from "../type/command";
|
||||||
import CardSetupFunction from "../Functions/CardSetupFunction";
|
import CardSetupFunction from "../Functions/CardSetupFunction";
|
||||||
import Config from "../database/entities/app/Config";
|
import Config from "../database/entities/app/Config";
|
||||||
|
import CardMetadataFunction from "../Functions/CardMetadataFunction";
|
||||||
|
|
||||||
export default class Resync extends Command {
|
export default class Resync extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -23,7 +24,15 @@ export default class Resync extends Command {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await CardSetupFunction.Execute()) {
|
let result: boolean;
|
||||||
|
|
||||||
|
if (!(process.env.FEATURE_METADATA && process.env.FEATURE_METADATA == 'true')) {
|
||||||
|
result = await CardMetadataFunction.Execute();
|
||||||
|
} else {
|
||||||
|
result = await CardSetupFunction.Execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
if (await Config.GetValue('safemode') == "true") {
|
if (await Config.GetValue('safemode') == "true") {
|
||||||
await Config.SetValue('safemode', 'false');
|
await Config.SetValue('safemode', 'false');
|
||||||
await interaction.reply("Resynced database and disabled safe mode.");
|
await interaction.reply("Resynced database and disabled safe mode.");
|
||||||
|
|
Loading…
Reference in a new issue