forked from noxious/server
Commands
This commit is contained in:
12
src/utilities/Chat.ts
Normal file
12
src/utilities/Chat.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export function isCommand(message: string, command?: string) {
|
||||
if (command) {
|
||||
return message.startsWith(`:${command} `)
|
||||
}
|
||||
return message.startsWith(':')
|
||||
}
|
||||
|
||||
export function getArgs(command: string, message: string): string[] | undefined
|
||||
{
|
||||
if (!isCommand(message, command)) return
|
||||
return message.split(`:${command} `)[1].split(' ')
|
||||
}
|
Reference in New Issue
Block a user