14 lines
368 B
TypeScript
14 lines
368 B
TypeScript
import { Server } from 'socket.io'
|
|
|
|
type CommandInput = string[]
|
|
|
|
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 })
|
|
}
|
|
}
|