Feature/48 database #114
4 changed files with 14 additions and 4 deletions
|
@ -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": {
|
||||||
|
|
|
@ -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 = [];
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
if (this.useDevPrefix) {
|
||||||
|
this.values.push({ Key: "bot.prefix", Value: "d!" });
|
||||||
|
} else {
|
||||||
this.values.push({ Key: "bot.prefix", Value: "v!" });
|
this.values.push({ Key: "bot.prefix", Value: "v!" });
|
||||||
|
}
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
this.values.push({ Key: "commands.disabled", Value: "" });
|
this.values.push({ Key: "commands.disabled", Value: "" });
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue