12 lines
375 B
TypeScript

export function isCommand(message: string, command?: string) {
if (command) {
return message === `/${command}` || 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(' ')
}