feature/5-drop-command #17
2 changed files with 10 additions and 5 deletions
|
@ -5,7 +5,7 @@ import Series from "../database/entities/card/Series";
|
|||
import path from "path";
|
||||
import { CardRarity } from "../constants/CardRarity";
|
||||
|
||||
export default class CardSetupFunctions {
|
||||
export default class CardSetupFunction {
|
||||
public async Execute() {
|
||||
await this.ClearDatabase();
|
||||
await this.ReadSeries();
|
|
@ -7,7 +7,8 @@ import { Command } from "../type/command";
|
|||
|
||||
import { Events } from "./events";
|
||||
import { Util } from "./util";
|
||||
import AppDataSource from "../database/dataSources/appDataSource";
|
||||
import CardSetupFunction from "../Functions/CardSetupFunction";
|
||||
import CardDataSource from "../database/dataSources/cardDataSource";
|
||||
|
||||
export class CoreClient extends Client {
|
||||
private static _commandItems: ICommandItem[];
|
||||
|
@ -15,6 +16,7 @@ export class CoreClient extends Client {
|
|||
|
||||
private _events: Events;
|
||||
private _util: Util;
|
||||
private _cardSetupFunc: CardSetupFunction;
|
||||
|
||||
public static get commandItems(): ICommandItem[] {
|
||||
return this._commandItems;
|
||||
|
@ -33,6 +35,7 @@ export class CoreClient extends Client {
|
|||
|
||||
this._events = new Events();
|
||||
this._util = new Util();
|
||||
this._cardSetupFunc = new CardSetupFunction();
|
||||
}
|
||||
|
||||
public async start() {
|
||||
|
@ -41,13 +44,15 @@ export class CoreClient extends Client {
|
|||
return;
|
||||
}
|
||||
|
||||
await AppDataSource.initialize()
|
||||
.then(() => console.log("Data Source Initialized"))
|
||||
.catch((err) => console.error("Error Initialising Data Source", err));
|
||||
await CardDataSource.initialize()
|
||||
.then(() => console.log("Card Data Source Initialised"))
|
||||
.catch(err => console.error("Error initialising Card Data Source", err));
|
||||
|
||||
super.on("interactionCreate", this._events.onInteractionCreate);
|
||||
super.on("ready", this._events.onReady);
|
||||
|
||||
await this._cardSetupFunc.Execute();
|
||||
|
||||
await super.login(process.env.BOT_TOKEN);
|
||||
|
||||
this._util.loadEvents(this, CoreClient._eventItems);
|
||||
|
|
Loading…
Reference in a new issue