Hello everyone! In this article, let's build a simple Discord bot with Node.js. This tutorial aims at beginners with zero knowledge on how to build a

How to Build a Discord Bot in Node.js

submited by
Style Pass
2021-05-26 14:33:33

Hello everyone! In this article, let's build a simple Discord bot with Node.js. This tutorial aims at beginners with zero knowledge on how to build a Discord bot.

First, we need to create our bot as an app in Discord. Go to https://discord.com/developers and sign in or create a developer account.

Then fill in the details of your app (i.e. name) and you will be taken to your app's dashboard. Navigate to 'Bot' and click 'Add Bot' to enable your app as a bot.

You will see an URL being generated at the bottom. Copy this URL and paste it on a new tab. You will be redirected to the page as shown below:

If you see the bot installed in your server, it is currently offline. The first thing we need to do to code our bot is creating a discord bot client and log our bot in.

Add this code block above your client.login(process.env.CLIENT_TOKEN); line and if you run node index.js again, your bot should reply you when you type ping.

Leave a Comment