Making your first command

circle-info

All of the following guide will be on the index.js file we created in the previous guide

How do command works?

Here is a basic system that how command work:

1. Player type in a command
2. The bot fetch the command
3. the bot finds the appropriate code
4. run the code

Getting stuff ready

To start, we will be using the message eventarrow-up-right. Message event emits whenever a message is sent in a server. So go ahead and type in the code below:

index.js
client.on("message", msg => {
    
})

We will be writing in line 2 of the code from now on.

Next, we will be getting message content that is sent in the server and validate it.

circle-exclamation

Adding more commands

To add more commands, just simply copy paste the if statement. Here is an example:

Last updated

Was this helpful?