Add debug mode, prefix config file
This commit is contained in:
parent
787fda193a
commit
d3499d2bbd
|
@ -0,0 +1,5 @@
|
||||||
|
prefixes:
|
||||||
|
- id: cosmic
|
||||||
|
spaced: true
|
||||||
|
- id: "*"
|
||||||
|
spaced: false
|
|
@ -1,3 +1,4 @@
|
||||||
|
debug: false
|
||||||
enableConsole: true
|
enableConsole: true
|
||||||
enableMPP: true
|
enableMPP: true
|
||||||
enableDiscord: true
|
enableDiscord: true
|
||||||
|
|
|
@ -8,6 +8,20 @@ import { createInventory, readInventory } from "../data/inventory";
|
||||||
import { hasPermission } from "../permissions";
|
import { hasPermission } from "../permissions";
|
||||||
import { Logger } from "../util/Logger";
|
import { Logger } from "../util/Logger";
|
||||||
import { balanceConfig } from "../economy/Balance";
|
import { balanceConfig } from "../economy/Balance";
|
||||||
|
import { loadConfig } from "../util/config";
|
||||||
|
|
||||||
|
const prefixConfig = loadConfig("config/prefixes.yml", {
|
||||||
|
prefixes: [
|
||||||
|
{
|
||||||
|
id: "cosmic",
|
||||||
|
spaced: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "*",
|
||||||
|
spaced: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
export interface CommandMessage<T = unknown> {
|
export interface CommandMessage<T = unknown> {
|
||||||
m: "command";
|
m: "command";
|
||||||
|
@ -32,16 +46,7 @@ export type BaseCommandMessage<T = unknown> = Omit<
|
||||||
|
|
||||||
export class CommandHandler {
|
export class CommandHandler {
|
||||||
public static commandGroups = new Array<CommandGroup>();
|
public static commandGroups = new Array<CommandGroup>();
|
||||||
public static prefixes = new Array<Prefix>(
|
public static prefixes = new Array<Prefix>();
|
||||||
{
|
|
||||||
id: "cosmic",
|
|
||||||
spaced: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "*",
|
|
||||||
spaced: false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
public static logger = new Logger("Command Handler");
|
public static logger = new Logger("Command Handler");
|
||||||
|
|
||||||
|
@ -155,3 +160,8 @@ export class CommandHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add prefixes
|
||||||
|
for (const prefix of prefixConfig.prefixes) {
|
||||||
|
CommandHandler.prefixes.push(prefix);
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { DiscordAgent } from "./discord";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const config = loadConfig("config/services.yml", {
|
const config = loadConfig("config/services.yml", {
|
||||||
|
debug: false,
|
||||||
enableConsole: true,
|
enableConsole: true,
|
||||||
enableMPP: false,
|
enableMPP: false,
|
||||||
enableDiscord: false,
|
enableDiscord: false,
|
||||||
|
@ -62,7 +63,8 @@ export class ServiceLoader {
|
||||||
color: mppConfig.desiredUser.color
|
color: mppConfig.desiredUser.color
|
||||||
}
|
}
|
||||||
: mppConfig.desiredUser,
|
: mppConfig.desiredUser,
|
||||||
env.MPPNET_TOKEN
|
env.MPPNET_TOKEN,
|
||||||
|
config.debug
|
||||||
);
|
);
|
||||||
|
|
||||||
mppAgent.start();
|
mppAgent.start();
|
||||||
|
|
|
@ -11,7 +11,8 @@ export class MPPAgent extends ServiceAgent<Client> {
|
||||||
uri: string,
|
uri: string,
|
||||||
public desiredChannel: string,
|
public desiredChannel: string,
|
||||||
public desiredUser: { name: string; color: string },
|
public desiredUser: { name: string; color: string },
|
||||||
token: string
|
token: string,
|
||||||
|
public debug: boolean = false
|
||||||
) {
|
) {
|
||||||
const cl = new Client(uri, token);
|
const cl = new Client(uri, token);
|
||||||
super("mpp", cl);
|
super("mpp", cl);
|
||||||
|
|
Loading…
Reference in New Issue