Greatly improved server code base
This commit is contained in:
@ -32,6 +32,18 @@ class ChatService {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public isCommand(message: string, command?: string) {
|
||||
if (command) {
|
||||
return message === `/${command}` || message.startsWith(`/${command} `)
|
||||
}
|
||||
return message.startsWith('/')
|
||||
}
|
||||
|
||||
public getArgs(command: string, message: string): string[] | undefined {
|
||||
if (!this.isCommand(message, command)) return
|
||||
return message.split(`/${command} `)[1].split(' ')
|
||||
}
|
||||
}
|
||||
|
||||
export default ChatService
|
||||
|
Reference in New Issue
Block a user