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", "typings": "./dist",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"start": "tsc && node ./dist/vylbot", "start": "node ./dist/vylbot",
"test": "jest" "test": "jest"
}, },
"repository": { "repository": {

View file

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

View file

@ -1,5 +1,6 @@
export default class DefaultValues { export default class DefaultValues {
public static values: ISettingValue[] = []; public static values: ISettingValue[] = [];
public static useDevPrefix: boolean = false;
public static GetValue(key: string): string | undefined { public static GetValue(key: string): string | undefined {
this.SetValues(); this.SetValues();
@ -16,7 +17,11 @@ export default class DefaultValues {
private static SetValues() { private static SetValues() {
if (this.values.length == 0) { if (this.values.length == 0) {
// Bot // 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 // Commands
this.values.push({ Key: "commands.disabled", Value: "" }); 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.RegisterCommands(client);
registry.RegisterEvents(client); registry.RegisterEvents(client);