Feature/48 database #114

Merged
Vylpes merged 12 commits from feature/48-database into develop 2022-03-29 18:19:54 +01:00
4 changed files with 14 additions and 4 deletions
Showing only changes of commit f7aa6a68b0 - Show all commits

View file

@ -6,7 +6,7 @@
"typings": "./dist",
"scripts": {
"build": "tsc",
"start": "tsc && node ./dist/vylbot",
"start": "node ./dist/vylbot",
"test": "jest"
},
"repository": {

View file

@ -1,6 +1,7 @@
import { Client } from "discord.js";
import * as dotenv from "dotenv";
import { createConnection } from "typeorm";
import DefaultValues from "../constants/DefaultValues";
import ICommandItem from "../contracts/ICommandItem";
import IEventItem from "../contracts/IEventItem";
import { Command } from "../type/command";
@ -24,10 +25,12 @@ export class CoreClient extends Client {
return this._eventItems;
}
constructor() {
constructor(devmode: boolean = false) {
super();
dotenv.config();
DefaultValues.useDevPrefix = devmode;
this._commandItems = [];
this._eventItems = [];

View file

@ -1,5 +1,6 @@
export default class DefaultValues {
public static values: ISettingValue[] = [];
public static useDevPrefix: boolean = false;
public static GetValue(key: string): string | undefined {
this.SetValues();
@ -16,7 +17,11 @@ export default class DefaultValues {
private static SetValues() {
if (this.values.length == 0) {
// Bot
this.values.push({ Key: "bot.prefix", Value: "v!" });
if (this.useDevPrefix) {
this.values.push({ Key: "bot.prefix", Value: "d!" });
} else {
this.values.push({ Key: "bot.prefix", Value: "v!" });
}
// Commands
this.values.push({ Key: "commands.disabled", Value: "" });

View file

@ -18,7 +18,9 @@ requiredConfigs.forEach(config => {
}
});
const client = new CoreClient();
const devmode = process.argv.find(x => x.toLowerCase() == "--dev") != null;
const client = new CoreClient(devmode);
registry.RegisterCommands(client);
registry.RegisterEvents(client);