Greatly improved server code base

This commit is contained in:
2024-12-28 17:26:17 +01:00
parent bd85908014
commit bd3bf6f580
39 changed files with 227 additions and 246 deletions

View File

@ -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