Running Your Bot
Starting Up Your Bot
Now that we’ve set up all the starter files and added some commands for our bot to use, we can start up the bot.
- First we have to register the commands that we created. Return to your terminal and run the file by writing
node runCommands.js
. When all your commands are registered, you should recieve a response from the console sayingSuccessfully registered application commands
. - Start up the bot with your custom script,
npm test
. When your bot is ready, your console will sayBot is online!
. - Now go back to your server, and the bot should be online. Typing
/
in the message bar will show all the commands that we created and their description. - Now try out the commands. The bot should reply to you with whatever command you gave it.
- To turn off your bot, press Ctrl+C twice in your terminal. Then to turn it back on, enter
npm test
ornode app.js
in the terminal.
Conclusion
Congratulations! You’ve successfully created your first Discord bot! If you want to scale up the bot or add some more functionality, Discord.js has extensive documentation on their different functions, and Discord’s has their own detailed documentation about their API.