forked from noxious/server
Update command manager and commands to OOP
This commit is contained in:
@ -2,8 +2,12 @@ import { Server } from 'socket.io'
|
||||
|
||||
type CommandInput = string[]
|
||||
|
||||
module.exports = function (input: CommandInput, io: Server) {
|
||||
const message: string = input.join(' ') ?? null
|
||||
if (!message) return console.log('message is required')
|
||||
io.emit('notification', { message: message })
|
||||
}
|
||||
export default class AlertCommand {
|
||||
constructor(private readonly io: Server) {}
|
||||
|
||||
public execute(input: CommandInput): void {
|
||||
const message: string = input.join(' ') ?? null
|
||||
if (!message) return console.log('message is required')
|
||||
this.io.emit('notification', { message: message })
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user