forked from noxious/server
Small improvement
This commit is contained in:
parent
599264b362
commit
04e081c31a
@ -11,7 +11,6 @@ export class ConsoleManager {
|
|||||||
private readonly registry: CommandRegistry
|
private readonly registry: CommandRegistry
|
||||||
private readonly prompt: ConsolePrompt
|
private readonly prompt: ConsolePrompt
|
||||||
private readonly logReader: LogReader
|
private readonly logReader: LogReader
|
||||||
private io: Server | null = null
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.registry = new CommandRegistry()
|
this.registry = new CommandRegistry()
|
||||||
@ -21,8 +20,6 @@ export class ConsoleManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async boot(): Promise<void> {
|
public async boot(): Promise<void> {
|
||||||
this.io = SocketManager.getIO()
|
|
||||||
|
|
||||||
await this.registry.loadCommands()
|
await this.registry.loadCommands()
|
||||||
this.logReader.start()
|
this.logReader.start()
|
||||||
this.prompt.start()
|
this.prompt.start()
|
||||||
@ -45,7 +42,7 @@ export class ConsoleManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const commandInstance = new CommandClass(this.io as Server)
|
const commandInstance = new CommandClass(SocketManager.getIO())
|
||||||
await commandInstance.execute(args)
|
await commandInstance.execute(args)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(`Error executing command ${cmd}: ${error instanceof Error ? error.message : String(error)}`)
|
this.logger.error(`Error executing command ${cmd}: ${error instanceof Error ? error.message : String(error)}`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user