Add devmode for default prefix
This commit is contained in:
parent
d5b3daaec5
commit
f7aa6a68b0
4 changed files with 14 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
"typings": "./dist",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "tsc && node ./dist/vylbot",
|
||||
"start": "node ./dist/vylbot",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -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 = [];
|
||||
|
||||
|
|
|
@ -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
|
||||
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: "" });
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue