Commands now dispose properly

This commit is contained in:
Ben
2018-11-25 18:45:47 +00:00
parent d83951a8f0
commit 84342cefb1
2 changed files with 10 additions and 10 deletions

View File

@@ -72,18 +72,22 @@ export class CommandManager {
console.log(); console.log();
Logger.info('Reloading Modules and Commands'); Logger.info('Reloading Modules and Commands');
// Does not call dispose function for (let command in commands) {
for (let command of commands) { await commands[command].Dispose();
await command.Dispose();
} }
Logger.info('Disposed registerd commands'); Logger.info('Disposed registerd commands');
for (let mod of modules) { // This broke af lol ReeEEEEeeE
await mod.module.Dispose(); for (let mod in modules) {
delete require.cache[require.resolve(mod.file)]; // Logger.error(modules[mod].module);
// await modules[mod].module.Dispose();
delete require.cache[require.resolve(modules[mod].mod)]; //file.split('.')[0])];
} }
Logger.info('Disposed registerd modules'); Logger.info('Disposed registerd modules');
modules = [];
commands = [];
CommandManager.load(1); CommandManager.load(1);
} }
} }

View File

@@ -7,10 +7,6 @@ export class Module {
static Init() { static Init() {
} }
static Dispose() {
Logger.error('module disposed')
}
} }
export class Command1 { export class Command1 {