Adds Event system and automatic messages
This commit is contained in:
parent
0e10ea3cab
commit
2f826fbf36
20 changed files with 428 additions and 18 deletions
|
|
@ -1,15 +1,17 @@
|
|||
import {Class} from "../types/Class";
|
||||
|
||||
export class Container {
|
||||
static instance: Container;
|
||||
|
||||
private instances: Map<string, object> = new Map();
|
||||
|
||||
public set<T extends {constructor: {name: string}}>(instance: T, name: string|null = null): void
|
||||
public set<T extends Class>(instance: T, name: string|null = null): void
|
||||
{
|
||||
const settingName = name ?? instance.constructor.name;
|
||||
this.instances.set(settingName.toLowerCase(), instance);
|
||||
}
|
||||
|
||||
public get<T>(name: string): T
|
||||
public get<T extends Class>(name: string): T
|
||||
{
|
||||
return <T>this.instances.get(name.toLowerCase());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {GuildEmojiRoleManager} from "discord.js";
|
|||
import {GroupConfigurationRepository} from "../Repositories/GroupConfigurationRepository";
|
||||
import {DiscordClient} from "../Discord/DiscordClient";
|
||||
import {IconCache} from "../Icons/IconCache";
|
||||
import {EventHandler} from "../Events/EventHandler";
|
||||
|
||||
export enum ServiceHint {
|
||||
App,
|
||||
|
|
@ -30,6 +31,8 @@ export class Services {
|
|||
const iconCache = new IconCache(discordClient);
|
||||
container.set<IconCache>(iconCache);
|
||||
|
||||
container.set<EventHandler>(new EventHandler());
|
||||
|
||||
// @ts-ignore
|
||||
configure({
|
||||
appenders: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue