Syntax validations
You can provide your own syntax validations that will be ran against every command. This function should throw an error if the syntax is incorrect.
Callback functions will be checked by NYXBCommands automatically. There is no need to actually implement this functionality yourself.
typescript
import { Command } from '@nyxb/commands'
export default (command: Command) => {
const { commandObject, commandName } = command
if (!commandObject.callback) {
throw new Error(
`Command "${commandName}" does not have a callback function.`
)
}
}
Command ValidationsRuntime validationsYou can provide your own runtime validations methods that will return a boolean for if the command should actually be ran or not.Event HandlerEvent HandlingNYXBCommands can automatically handle your event listening in multiple files and folders. You can even setup "dynamic validations" to only run some events when a specific condition is met. More on that in the next section of the documentation.
Here is an example of how to setup a basic event listening system: